NPM cannot install "truffle" on Windows - node.js

I am trying to install "truffle" with npm, but I am not familiar with NodeJS and cant figure out why npm wont install it. I try npm install -g truffle in Powershell with Admin rights and after a few lines of output I get this block of error messages:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (F:\nodeJS\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "F:\\nodeJS\\node.exe" "F:\\nodeJS\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Max\AppData\Roaming\npm\node_modules\truffle\node_modules\ether-pudding\node_modules\ethereumjs-testrpc\node_modules\ethereumjs-wallet\node_modules\scrypt.js\node_modules\scrypt
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok\
And then after many many yellow lines I finally get this:
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "F:\\nodeJS\\node.exe" "F:\\nodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "truffle"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
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! 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 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! F:\eth_truffle\npm-debug.log
After that nothing else happens and after a while it just terminates. There are no files (other than a single log file) in the directory I am currently in and the keyword "truffle" can also not be found by cmd/powershell.
As I said I have never worked with NodeJS before and have no idea what all this means. What I can do to get truffle running?

Your install is failing at node-gyp rebuild. Solutions to this problem are listed on the node-gyp repo. The quickest is:
"Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator)." This will install Python and Visual Studio correctly.
Also, you are using Node 4.5. The recommended version is 5+, according to the Truffle Docs

I was also facing the same problem...
Solution:
Run as administrator
npm install --global windows-build-tools
npm install -g truffle

Related

Error installing bcrypt with NPM in meteor

I've searched around for a couple of days trying to resolve this issue, and although people have had issues installing bcrypt with NPM, they don't appear to be like mine. For those of you finding this via Google, I suggest you also take a look at this post.
Now I get the following error, as do others, when installing bcrypt:
> bcrypt#0.8.7 install /home/william/bonsai/brain/src/hyperdev/node_modules/bcrypt
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:354:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-28-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/william/bonsai/brain/src/hyperdev/node_modules/bcrypt
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
hyperdev# /home/william/bonsai/brain/src/hyperdev
└── touch#1.0.0 extraneous
npm ERR! Linux 4.4.0-28-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.7 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 bcrypt 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 bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/william/bonsai/brain/src/hyperdev/npm-debug.log
I have all of bcrypt's dependencies installed, so I am genuinely unsure of how to proceed. Here is the npm debug log needed.
I think this is a known bug in Meteor.
I use debian8.6-64bit.
I remove accounts-password and npm-bcrypt, and then I do
meteor add npm-bcrypt
meteor npm install -g node-gyp
meteor npm install --save bcrypt
meteor npm install --save babel-runtime
meteor add accounts-password
Finally, I fix the bug. I'm not sure of its effectiveness, if you change order of command.

Fail npm install (at the socketwatcher#0.3.0 install 'node-gyp rebuild')

I'm trying to reprogram a dash button to send an SMS to a phone. The task I am trying to attempt is located here: https://github.com/sanzgiri/dash-sms. Below is a copy of the error message I've been getting. Any insight is much appreciated. I'm using Ubuntu version 16 in a virtual machine.
rebecca#rebecca-VirtualBox:~$ sudo npm install node-dash-button
> socketwatcher#0.3.0 install /home/rebecca/node_modules/socketwatcher
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node- gyp/lib/configure.js:354:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-21-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/rebecca/node_modules/socketwatcher
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-dash-button"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! socketwatcher#0.3.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the socketwatcher#0.3.0 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 socketwatcher 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 socketwatcher
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls socketwatcher
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/rebecca/npm-debug.log
I believe the code is confugure to work with "node" instead of "nodejs".
You can setup a simlink or just run this command. It solved the issue for me.
sudo apt install nodejs-legacy
Had the same issue and nothing would work. Finally had to go to node 0.10.26 on the pi.
Used NVM instead of direct node install.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
nvm install 0.10.26

Error installing a npm module (printer) on linux

I am trying to install a printer module for node on a lubuntu system, but making the npm installation, I get this:
gyp: Call to 'cups-config --libs' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:344:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.16.0-23-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/puesto1/app/node_modules/printer
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! printer#0.1.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the printer#0.1.1 install script.
npm ERR! This is most likely a problem with the printer 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 printer
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.16.0-23-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/puesto1/app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/puesto1/app/npm-debug.log
npm ERR! not ok code 0
It is a recently installed lubuntu, and I don´t know what to do. Any suggestion to solve the problem?? Any other module to print??
Thank you.
I think node-gyp is not up to date in your system and also cups-config is not installed, try to re-install node-gyp using apt-get with this command : sudo apt-get install node-gyp and install cups-config using command : sudo apt-get install libcups2-dev

npm install fails with gyp build error

I have been trying to get node and git working for a web project I am working on without any luck.
I have installed node from their website. When I try to do npm install on the git project I am working on it gives me the following error
C:\Users\Jibran\Desktop\ekhadim\ekhadimweb>npm install
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
> bcrypt#0.7.8 install C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\node_modules\b
crypt
> node-gyp rebuild
C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\node_modules\bcrypt>node "C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\
node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform
.Targets(23,7): error MSB8007: The Platform for project 'bcrypt_lib.vcxproj' is
invalid. Platform='x64'. You may be seeing this message because you are tryin
g to build a project without a solution file, and have specified a non-default
Platform that doesn't exist for this project. [C:\Users\Jibran\Desktop\ekhadim\
ekhadimweb\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:807:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\node_modules\bcrypt
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
npm ERR! bcrypt#0.7.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.7.8 install script.
npm ERR! This is most likely a problem with the bcrypt 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 bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\Jibran\Desktop\ekhadim\ekhadimweb
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\npm-debug.log
npm ERR! not ok code 0
I have installed python, VC++ 2008 and 2010 and OpenSSL but nothing has worked for me yet.
Any help will be appreciated.
Thanks
Jibran
Installing windows build tools worked for me:
npm install --global --production windows-build-tools
Follow : https://github.com/nodejs/node-gyp#installation
Installing windows-build-tools didn't work for me. What did the trick was directly downloading and installing Python.

Install ctags from npm: no such option --no-parallel

I recently installed node and npm to try it out but during an installation of a module it stuck on the ctags package which it depended on. Trying to only install ctags resulted in a weird error which I could not find a solution for.
henje#mymachine:~/test/node-ctags$ npm install
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/nan/0.8.0
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/grunt-contrib-coffee
npm http GET https://registry.npmjs.org/event-stream
npm http GET https://registry.npmjs.org/grunt-shell
npm http GET https://registry.npmjs.org/node-gyp
[...]
> ctags#0.11.0 install /home/henje/test/node-ctags
> node-gyp rebuild
Usage: gyp_main.py [options ...] [build_file ...]
gyp_main.py: error: no such option: --no-parallel
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 2
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 2.6.36.4-vs2.3.0.36.39-nc
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/henje/test/node-ctags
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! ctags#0.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ctags#0.11.0 install script.
npm ERR! This is most likely a problem with the ctags 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 ctags
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.36.4-vs2.3.0.36.39-nc
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/henje/test/node-ctags
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.6
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/henje/test/node-ctags/npm-debug.log
npm ERR! not ok code 0
I am not sure if this is a general issue or just. I tried npm install ctags as well as cloning from github. I also checked if I have a recent gcc, etc. for gyp and have no idea left. I appreciate any answers.
I have also faced this issue while trying to install pm2 module.
As a workaround, removing gyp solved this problem for me:
sudo apt-get remove gyp
Here is the issue itself listed in pm2 repository: https://github.com/Unitech/pm2/issues/434

Resources