npm ERR!: code 127. gyp ERR! stack Error: Command failed - npm

I'm getting the following error while doing npm install:
$ npm install
npm ERR! code 127
npm ERR! path /home/jesusjimenez/projects/project/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node build.js || nodejs build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#15.12.0 | linux | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:326:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:453:11)
npm ERR! gyp ERR! stack at Socket.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:665:12)
npm ERR! gyp ERR! System Linux 5.8.0-48-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/jesusjimenez/projects/project/node_modules/.bin/node-gyp" "rebuild" "--release"
npm ERR! gyp ERR! cwd /home/jesusjimenez/projects/project/node_modules/fibers
npm ERR! gyp ERR! node -v v15.12.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! node-gyp exited with code: 1
npm ERR! Please make sure you are using a supported platform and node version. If you
npm ERR! would like to compile fibers on this machine please make sure you have setup your
npm ERR! build environment--
npm ERR! Windows + OS X instructions here: https://github.com/nodejs/node-gyp
npm ERR! Ubuntu users please run: `sudo apt-get install g++ build-essential`
npm ERR! RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
npm ERR! Alpine users please run: `sudo apk add python make g++`
npm ERR! sh: 1: nodejs: not found
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jesusjimenez/.npm/_logs/2021-03-30T21_32_02_097Z-debug.log
I'm not completely sure what is breaking the install, if fibers or somehow that python SyntaxError: invalid syntax
However, trying to install fibers individually throws same error. npm i -g fibers doesn't fix, neither changing npm configure set python /path/to/python. Deleting fibers momentarily keeps throwing same Python SyntaxError: invalid syntax error, this time with another node_module.

This is the solution to this issue.
Explanation:
Notice this part of your NPM error log:
npm ERR! gyp ERR! node-gyp -v v3.8.0
This means your code is trying to install node-gyp of the version 3.8.0
What is probably happening (this was in my case) you have a wrong NodeJS version, for node-gyp.
I searched for the right version of NodeJS for node-gyp 3.8.0, and the answer is below.
Solution:
Uninstall current NodeJS version
Install NodeJS Version 6.17.1 (if you need multiple NodeJS versions use NVM tool (Instructions For Windows/Linux/MacOS) https://www.nubo.eu/Install-Multiple-Node-Versions-On-Windows/
Run npm install in your project again

I got this error when I set a PATH variable incorrectly which meant npm and node couldn't be found correctly.
To diagnose this, I ran
npm --version
node --version
It said command not found, so I checked env | grep PATH which showed me that the location of npm and node weren't on PATH as they needed to be. Once I fixed that, everything worked as expected.

I got the same/similar issue without making any changes to version of node. I hate to be that guy, but after a day of struggling with it I decided to restart my machine. That fixed it...

The issue is that node-gyp tries to build with Python 2 syntax: print "%s.%s.%s" % sys.version_info[:3]; which throws an error probably because you have Python 3 on your computer.
This usually occurs when installing an outdated npm module which is not compatible with the current Node version on your system. Try installing Python 2 and set it to the path, or locate the offending module in package.json and then upgrade the version number to the one that is compatible with your current Node version.

Related

Sharp returning errors on npm install for M1 Big Sur

I'm trying to install sharp for my project. When running npm i and npm install sharp, I am receiving the same errors about sharp (shown below). I've tried installing libvip globally and locally, and read about every thread about this issue and cannot seem to find the right solution. Any suggestions are welcome.
rosetta error: /var/db/oah/223263137464320_223263137464320/e6ddd63cd8fd3b7ef226e2cad9a1bead9d7f41f60d7ece6edd0cdcc0c33c97c6/libxcrun.dylib.aot: attachment of code signature supplement failed: 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: null
gyp ERR! stack at ChildProcess.onExit (/Users/elektra.murphy/.nvm/versions/node/v11.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/elektra.murphy/.nvm/versions/node/v11.11.0/bin/node" "/Users/elektra.murphy/.nvm/versions/node/v11.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/elektra.murphy/Desktop/Projects/node_modules/sharp
gyp ERR! node -v v11.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/Users/elektra.murphy/Desktop/Projects/package.json'
npm WARN No description
npm WARN No repository field.
npm WARN No README data
npm WARN No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp#0.23.2 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp#0.23.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/elektra.murphy/.npm/_logs/2021-10-12T08_24_48_579Z-debug.log
Found a solution for this in the Sharp docs: When using npm v6 or earlier, the npm install --unsafe-perm flag must be used when installing as root or a sudo user. Seems to have worked - now on to the next error!
Find more here on M1 installations:
https://sharp.pixelplumbing.com/install

Error while installing npm-java on Ubuntu 18.0.4

I have latest npm 6.7.0 version. I tried to install npm-java module but it gives following error. Here I can see permission issue but I am running it with root permission using sudo. What is the reason for this issue and how to get it fixed?
malintha#malintha-laptop:~$ sudo npm -g install java
> java#0.11.0 install /usr/local/lib/node_modules/java
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/java/build'
gyp ERR! System Linux 4.15.0-44-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/java
gyp ERR! node -v v8.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java#0.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java#0.11.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/malintha/.npm/_logs/2019-02-04T11_42_36_223Z-debug.log
Solved it removing sudo from the installation command. Just run npm installjava

npm install for Hyperledger Tutorial Fails

I am currently working on a fresh minimal install of Ubuntu 16.0.4 using Hyperledger Fabric. I have pulled down a fresh install of the fabric samples from the Hyperledger documentation site. I have downloaded the following software:
node version 6.9.5
npm version 3.10.10
docker version 17.03.2-ce
golang version 1.7.6 (documentation now calls for newer version, but I think this is unrelated)
I can navigate to the fabcar directory which contains the default npm package.json. I first run ./startFabric as indicated in the instructions. I then run npm install, per the instructions. I then get the error:
u#ubmin2:~/fabric-samples/fabcar$ npm install
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js#1.0.9 install /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> npm run build
> pkcs11js#1.0.9 build /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp configure build
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:14:12)
gyp ERR! stack at F (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:69:19)
gyp ERR! stack at E (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/u/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pkcs11js#1.0.9 build: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.9 build script 'node-gyp configure build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
...
Based on that, it appears that there is a missing pkcs11js module that needs to be included. When I add that module to the package.json file, remove the node_modules file and rerun the "npm install," the error shifts to:
u#ubmin2:~/fabric-samples/fabcar$ npm install
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js#1.0.9 install /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> npm run build
> pkcs11js#1.0.9 build /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp configure build
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:14:12)
gyp ERR! stack at F (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:69:19)
gyp ERR! stack at E (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/u/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pkcs11js#1.0.9 build: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.9 build script 'node-gyp configure build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /home/u/fabric-samples/fabcar/node_modules/pkcs11js/npm-debug.log
fabcar#1.0.0 /home/u/fabric-samples/fabcar
...
Does anyone understand why npm install is failing to run as expected?
------UPDATE------
in response to christo4ferris, sorry, I should have shown that as well. I've tried many things including installing and removing make. when I install make, I still get an error:
npm WARN fabcar#1.0.0 No repository field.
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! path /home/u/fabric-samples/fabcar/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/u/fabric-samples/fabcar/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/home/u/fabric-samples/fabcar/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/home/u/fabric-samples/fabcar/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/u/fabric-samples/fabcar/npm-debug.log
And then, when I run as sudo us to run as root, I get this error message:
root#ubmin2:/home/u/fabric-samples/fabcar# npm install
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js#1.0.9 install /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> npm run build
> pkcs11js#1.0.9 build /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp configure build
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/u/fabric-samples/fabcar/node_modules/pkcs11js/.node-gyp"
make: Entering directory '/home/u/fabric-samples/fabcar/node_modules/pkcs11js/build'
CXX(target) Release/obj.target/pkcs11/src/main.o
make: g++: Command not found
pkcs11.target.mk:107: recipe for target 'Release/obj.target/pkcs11/src/main.o' failed
make: *** [Release/obj.target/pkcs11/src/main.o] Error 127
make: Leaving directory '/home/u/fabric-samples/fabcar/node_modules/pkcs11js/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/u/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pkcs11js#1.0.9 build: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.9 build script 'node-gyp configure build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /home/u/fabric-samples/fabcar/node_modules/pkcs11js/npm-debug.log
fabcar#1.0.0 /home/u/fabric-samples/fabcar
Thank you.
The issue was that I was missing a necessary c++ compiler. It seems it was not included in the Ubuntu minimal installation, which makes sense, but the errors seemed very opaque. Running sudo apt install build-essential g++ seems to have solved the problem.
I'm not sure if it was necessary, but I also needed to add alias sudo='sudo env PATH=$PATH' to my .bashrc file so I could run npm with sudo. That solution came from this link.

Trying to install truffle on Windows 10 by "$npm install - g truffle" Got a bunch of problems

$ npm install -g truffle
npm WARN deprecated to-iso-string#0.0.2: to-iso-string has been deprecated, use #segment/to-iso-string instead.
npm WARN deprecated jade#0.26.3: Jade has been renamed to pug, please install th e latest version of pug instead of jade
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
scrypt#6.0.3 preinstall C:\Users\Zachary Zhong\AppData\Roaming\npm\node_module s.staging\scrypt-b6fa2906
node node-scrypt-preinstall.js
C:\Users\Zachary Zhong\AppData\Roaming\npm\truffle -> C:\Users\Zachary Zhong\App Data\Roaming\npm\node_modules\truffle\cli.js
C:\Users\Zachary Zhong\AppData\Roaming\npm\truffle-exec -> C:\Users\Zachary Zhon g\AppData\Roaming\npm\node_modules\truffle\exec.js
scrypt#6.0.3 install C:\Users\Zachary Zhong\AppData\Roaming\npm\node_modules\t ruffle\node_modules\scrypt
node-gyp rebuild
C:\Users\Zachary Zhong\AppData\Roaming\npm\node_modules\truffle\node_modules\scr ypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modul es\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Warning: Missing input files:
C:\Users\Zachary Zhong\AppData\Roaming\npm\node_modules\truffle\node_modules\scr ypt\build..\scrypt\win\include\config.h
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Copying scrypt/win/include/config.h to scrypt/scrypt-1.2.0/config.h
The system cannot find the file specified.
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\Zachary Zhong\AppData\Roaming\npm\node_modules\truffle \node_modules\scrypt\build\copied_files.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\Zachary Zhong\AppData\Roaming\npm\node_modules\truffle \node_modules\scrypt\build\scrypt_wrapper.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe fail ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\ npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces s.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Zachary Zhong\AppData\Roaming\npm\node_modules\truffle\nod e_modules\scrypt
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
C:\Users\Zachary Zhong\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\truffle\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "truffle"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! scrypt#6.0.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt#6.0.3 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the scrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs scrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls scrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Zachary Zhong\npm-debug.log
npm ERR! code 1
I've got 2 guides for installing on Windows:
Installing on Windows 10 using Ubuntu bash (preferred)
https://davidburela.wordpress.com/2017/05/12/how-to-install-truffle-testrpc-on-ubuntu-or-windows-10-with-windows-subsystem-for-linux/
Installing on Windows
https://davidburela.wordpress.com/2016/11/18/how-to-install-truffle-testrpc-on-windows-for-blockchain-development/
Given that you have not include any details about your dev environment, see this StackOverflow thread that discusses the same problem as yours: node gyp error TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified

node gyp rebuild fail

im trying to install a nodejs application but I keep getting the same error about "node-gyp" failing to rebuild.
I dont know a lot about nodejs, apart from I can get this to work on my local machine fine but I cant figure out why it wont run on the server.
Ubuntu 14.04
Node v0.12.5
npm v2.11.2
> ws#0.4.32 install /root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
> ref#1.0.2 install /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
> node-gyp rebuild
make: Entering directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
CXX(target) Release/obj.target/binding/src/binding.o
make: g++: Command not found
make: *** [Release/obj.target/binding/src/binding.o] Error 127
make: Leaving directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-52-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
gyp ERR! node -v v0.12.5
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Linux 3.13.0-52-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! ref#1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref#1.0.2 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ref package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls ref
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/banquo-server/npm-debug.log
Any help much appreciated.
Regards
Luke
It seems you have a conflict with an older package that is getting in the way.
Try below commands helped me to resolve the issue, might help you too... these commands might need sudo access
npm cache clean -f
npm install -g n
n stable
npm install npm -g
So above solves the problem when there is any conflict in packages version.... but by looking at logs it says make: g++: Command not found Which means you need to install developer tools
have you tried installing node-gyp via apt-get install:
apt-get install node-gyp
The command g++ is not found, so you need to install the g++ package (along with build-essential which includes other packages that are required to build/compile programs):
sudo apt-get install build-essential g++