To install StrongLoop tools (but not API Connect), you must have compiler tools installed.

Why do I need to install a compiler?

Some devops features such as monitoring and memory / CPU profiling require native (C++) code.  StrongLoop distributes its software with npm, but npm compiles native code upon installation.  Therefore, to take advantage of these features, you must install a compiler. If you don’t want these features, you may see error messages, but you should still be able install successfully.

Page Contents

Overview

If you don’t have a C++ compiler (Visual C++ on Windows or XCode on OSX) and associated command-line tools, you won’t be able to view most useful metrics, and you won’t be able to perform CPU profiling or take heap snapshots

Configuring Python directory

Npm uses node-gyp to compile native modules, and node-gyp requires Python.  If you installed Python in a non-standard directory, run this command to configure your setup:

$ npm config set python /path/to/python

where /path/to/python is the directory where Python is installed.

For more information, see the node-gyp documentation.

Windows

Install the following:

For Windows 7:

  • For 64-bit builds of Node and native modules you will also need the Windows 7 64-bit SDK.  If the install 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.

Python

npm uses Python 2.7 (not 3.x, and not 2.6.x or earlier) to install packages with compiled add-ons (such as strong-agent, or websocket support).

Download Python 2.7.x from http://python.org:

  1. Go to https://www.python.org/downloads/windows/
  2. Download latest stable 2.7.x Windows MSI Installer, either x86 or x86-64, as appropriate
  3. Run installer, and make sure to add to Path:
    • Accept the default, Install for all users.
    • Accept default “c:\Python27” for Python files.
    • Enable the option Add python.exe to Path.

Visual Studio

npm uses Visual Studio 2012 or later to install packages with compiled add-ons (like strong-agent, or websocket support).  

For Windows 7 and 8, use Microsoft Visual Studio 2015 (Community):

  1. Go to: https://www.visualstudio.com/downloads/download-visual-studio-vs
  2. Select “Download Community Free”, then download “vs_community_ENU.exe” , and next

If the download doesn’t start, click the Click here link, then on the next download page, click the Click here link beside vs_community_ENU.exe.

Run the installer, check “Visual C++” under “Programming Languages”, and accept the default location.

MacOS

Install:

  • Apple Xcode.
  • Depending on your version of MacOS and Xcode, you may need to also install the command-line tools.  To install them in Xcode:
    1. Click Xcode > Preferences.
    2. Choose Downloads.
    3. Click the install button next to “Command-line Tools”.

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

Xcode license issues

If you see errors such as:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Then you recently upgraded or installed Xcode and haven’t agreed to the license yet. 

Enter the following command to validate your Xcode license, then reinstall StrongLoop:

$ sudo xcode-select

Linux

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

  • Python (v2.7 recommended; v3.x.x is not supported).  If you installed Python in a non-standard location, see Configuring Python directory.
  • make
  • A proper 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

Adding swap space

If during installation, you see the error message:

virtual memory exhausted: Cannot allocate memory

Then you need to add swap space so the compiler will have enough RAM.  For example:

$ dd if=/dev/zero of=/swap bs=1M count=1024 
$ mkswap /swap 
$ swapon /swap

After entering these commands, reinstall StrongLoop.

Note that the above command does not make the change permanent.  When you reboot, you’ll need to re-run the swapon /swap command if you want to reinstall or if your application uses binary add-ons.

For more information, see How To Configure Virtual Memory (Swap File) on a VPS.