Tutorial: Installing LoopBack connectors

This tutorial shows you how to install a LoopBack® data source connector manually by using the command line.

Before you begin

To install a data source connector, you must be able to run an npm install command, which requires a connection to the internet. Alternatively, you can configure a private npm repository.

The Oracle, DB2®, and SQLLite connectors require C compiler tools to build and install binary extensions. The exact requirements depend on your operating system. Once you have installed compiler tools, you can install the connector following the instructions in the following procedure.

[Icon indicating that this applies on Windows platforms]
Note: You may need to restart your computer at various points during installation.
  • Microsoft .NET Framework 4.0
  • Visual Studio. Use Visual Studio Community unless you want purchase Visual Studio Enterprise. Run the installer, check "Visual C++" under "Programming Languages", and accept the default installation location.
    Note: The Visual Studio installation can take a long time.
  • Windows SDK. If the installation fails, look for C++ 2010 x64&x86 Redistributable in your installed programs and uninstall it.
  • Python 2.7.10.
  • Version 3 of npm. Enter the following command:
    npm install -g npm
    Then ensure the npm command uses the correct version:
    npm -v

    If the version shown is not 3.x.x, then edit your system PATH to ensure that C:\Users\username\AppData\Roaming\npm supersedes any other entries.

  • For 64-bit builds of Node.js and native modules you also need the Windows 7 64-bit SDK. If the installation fails, try uninstalling any C++ 2010 x64&x86 redistributable that you have installed first. If you get errors that the 64-bit compilers are not installed you may also need the compiler update for the Windows SDK 7.1.
Note: Do not use Cygwin (Windows bash shell emulator). Use the Windows command shell instead.
[Icon indicating that this applies on Mac OS X platforms]

You must have the command-line developer tools (or full installation of Xcode) and Python.

If you don't already have Xcode or the command-line tools installed, installation will prompt you as follows:
Install command line developer tools

Click Install to install the command-line developer tools only. Alternatively, you can click Get Xcode to install the full Xcode product, but doing this can take a long time.

Python is also required. Most versions of OSX come with Python by default. If for some reason you don't have it, download and install Python.

[Icon indicating that this applies on Linux platforms]

Many Linux® systems come with the necessary tools. The specific requirements are:

  • Python version 2.7. NOTE: version 3.x is not supported.
  • make
  • A C/C++ compiler toolchain, like GCC. NOTE: g++ version 4.2 or later is required.
On Debian and Debian-derived distributions (Ubuntu, Mint, and so on), use the command:
apt-get install build-essential

About this task

Before you can use a LoopBack data source to access data in a backend system such as a database, you must install the data source connector. The In-memory and email connectors are built-in to LoopBack, so you don't need to install them. The command-line tool and API Designer will automatically prompt you to install connectors as needed, but you can also do it manually.

Install a new data source connector manually by following these steps:


  1. Open a new shell window.
  2. Install the connector package by entering this command in the project root directory:
    npm install --save connector-package
    where connector-package is the name of the npm package for the LoopBack connector, as shown in the table.
    Table 1. LoopBack Connectors
    Data Source Connector Package
    Database connectors
    Cloudant® loopback-connector-cloudant
    DashDB loopback-connector-dashdb
    DB2 loopback-connector-db2
    DB2 for zOS loopback-connector-db2z
    Microsoft SQL Server loopback-connector-mssql
    MongoDB loopback-connector-mongodb
    MQ Light loopback-connector-mqlight
    MySQL loopback-connector-mysql
    Oracle loopback-connector-oracle
    PostgreSQL loopback-connector-postgresql
    Other connectors
    SOAP web services loopback-connector-soap
    REST web services loopback-connector-rest
  3. For Oracle, you must also set the LD_LIBRARY_PATH environment variable in IBM® Cloud to /home/vcap/app/node_modules/instantclient.


You successfully installed a new data source connector for LoopBack.

Installing the Oracle connector

About this task

The LoopBack Oracle connector might require some additional installation and troubeshooting steps. Either follow the manual installation and troubleshooting steps or install the LoopBack CLI that provides an additional command to install and troubleshoot the Oracle connector:
  • Follow the instructions in Installing the Oracle connector for your platform.
  • If you prefer (or if you still have issues with the connector), install the LoopBack CLI by using the comand:
    npm install -g loopback-cli
    Then enter the following command to install and troubleshoot the Oracle connector:
    lb oracle
    This command determines if the connector is ready to use. If it is, the tool will print "Oracle connector is ready" and exit. Otherwise, it will prompt you to install Oracle Instant Client, loopback-connector-oracle, and the oracledb module. For more information, see Oracle installer command.