Issue
The following error is seen during the installation of the Node agent:
npm ERR! @contrast/distringuish@1.2.0 build: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @contrast/distringuish@1.2.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Cause
From versions 2.0.0 to 2.5.1 of the Node agent, you must have installed:
- A C++ compiler toolchain (e.g., Clang, GCC or MSVC) and a POSIX-compatible
make
- Python (which is needed for Node-gyp, Node's build tool, to function)
Notes: If you can build other modules with C++ bindings like node-sass and sqlite3, you probably meet all of the requirements for Contrast. The official Node Docker images come with all of the prerequisites installed.
Resolution
Windows
To install the necessary compiler toolchain on Windows, run npm install -g --production
windows-build-tools
. If you're using a Node version older than 8.0, you must use windows-build-tools
version 3.0 (not 4.0, the newest version).
macOS
macOS ships with the clang
compiler suite. Use clang --version
to ensure that you have the compiler installed. If Clang is not already installed, run $ xcode-select --install
to install it.
Linux
Linux distributions often ship with a C++ compiler toolchain. You can verify that the compiler is installed with c++ --version
. If you don't have a C++ compiler installed, install the g++
package available from most Linux package managers.