Web3.js: Can't install web3 on windows or ubuntu

Created on 21 Sep 2017  ยท  13Comments  ยท  Source: ChainSafe/web3.js

C:\Users\Spader>npm install web3
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue


 [email protected] preinstall C:\Users\Spader\node_modules\.staging\scrypt-27aa434c
> node node-scrypt-preinstall.js


> [email protected] install C:\Users\Spader\node_modules\scrypt
> node-gyp rebuild


C:\Users\Spader\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Warning: Missing input files:
C:\Users\Spader\node_modules\scrypt\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.
MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, eith
er 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual
Studio 2008.  [C:\Users\Spader\node_modules\scrypt\build\binding.sln]
MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, eith
er 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual
Studio 2008.  [C:\Users\Spader\node_modules\scrypt\build\binding.sln]
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: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 Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Spader\node_modules\scrypt
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
[email protected] C:\Users\Spader
`-- (empty)

npm WARN [email protected] No repository field.
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" "web3"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild'
npm ERR! Exit status 1

I've tried updating nodejs, npm, I've downloaded the windows SDK in the message, and visual studios. I have visual studios 2017 and 2015. I've tried npm install msvs=2008, and finally I tried switching over to linux. On ubuntu I get a different error, but still ultimately fails at

npm ERR! [email protected] install: node-node-scrypt-preinstall.js'
npm ERR! spawn ENOENT

I don't think this is related to web3, but I can't install any ethereum packages, so can someone help me?

I've been struggling with this for a week now and I don't know how to fix this. It looks like I may need a new computer to try programming some Dapps...

bug

Most helpful comment

I had similar problem in Ubuntu, not exactly the same though. I solved it by installing GCC compiler: sudo apt-get install build-essential, then I am able to install web3

All 13 comments

Try install node-gyp before

Also having this problem, did install node-gyp before and place it in the correct folder. Running Ubuntu 16.04.

Same problem on Ubuntu 16.04

update : it woks after installing node 6.x
follow the instructions here : https://askubuntu.com/questions/786272/why-does-installing-node-6-x-on-ubuntu-16-04-actually-install-node-4-2-6

I am getting the same error on Windows

@pd164594 I had the same issue and solved it as given below:
run: npm install --global --production windows-build-tools
refer: https://github.com/nodejs/node-gyp

I had similar problem in Ubuntu, not exactly the same though. I solved it by installing GCC compiler: sudo apt-get install build-essential, then I am able to install web3

@dejunqi2008 That worked for me. Thanks

Im having this problem on ubuntu 16.04.

This is by debug log

857 silly saveTree โ”‚ โ”‚ โ”œโ”€โ”ฌ scrypt.[email protected]
857 silly saveTree โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [email protected]
857 silly saveTree โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
857 silly saveTree โ”‚ โ”‚ โ”œโ”€โ”€ [email protected]
857 silly saveTree โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
857 silly saveTree โ”‚ โ””โ”€โ”ฌ [email protected]
857 silly saveTree โ”‚ โ””โ”€โ”€ [email protected]
857 silly saveTree โ”œโ”€โ”€ [email protected]
857 silly saveTree โ”œโ”€โ”€ [email protected]
857 silly saveTree โ””โ”€โ”€ [email protected]
858 warn [email protected] requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
859 verbose stack Error: [email protected] install: node-gyp rebuild
859 verbose stack Exit status 1
859 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
859 verbose stack at EventEmitter.emit (events.js:180:13)
859 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
859 verbose stack at ChildProcess.emit (events.js:180:13)
859 verbose stack at maybeClose (internal/child_process.js:936:16)
859 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
860 verbose pkgid [email protected]
861 verbose cwd /home/ancientevil/CompleteDevelopersGuide
862 verbose Linux 4.13.0-38-generic
863 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "[email protected]" "--unsafe-perm=true" "--allow-root" "web3"
864 verbose node v9.10.1
865 verbose npm v5.6.0
866 error code ELIFECYCLE
867 error errno 1
868 error [email protected] install: node-gyp rebuild
868 error Exit status 1
869 error Failed at the [email protected] install script.
869 error This is probably not a problem with npm. There is likely additional logging output above.
870 verbose exit [ 1, true ]

It seems that I am missing [email protected] and cannot install it? Super lost

@LEscobar-Driver did you do sudo apt-get install build-essential ?

@iurimatias Yes I did that. This is the end of my debug log

6806 warn optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
6807 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6808 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
6808 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
6808 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux
6808 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
6809 verbose stack Error: [email protected] install: node-gyp rebuild
6809 verbose stack Exit status 1
6809 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16)
6809 verbose stack at EventEmitter.emit (events.js:180:13)
6809 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
6809 verbose stack at ChildProcess.emit (events.js:180:13)
6809 verbose stack at maybeClose (internal/child_process.js:936:16)
6809 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
6810 verbose pkgid [email protected]
6811 verbose cwd /home/ancientevil/CompleteDevelopersGuide
6812 verbose Linux 4.4.0-119-generic
6813 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "[email protected]"
6814 verbose node v9.8.0
6815 verbose npm v5.8.0
6816 error code ELIFECYCLE
6817 error errno 1
6818 error [email protected] install: node-gyp rebuild
6818 error Exit status 1
6819 error Failed at the [email protected] install script.
6819 error This is probably not a problem with npm. There is likely additional logging output above.
6820 verbose exit [ 1, true ]

I too face same issue on Ubuntu 16.04. I tried sudo apt-get install build-essential, but it too didn't resolve the error.

$ sudo npm install --save web3npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated [email protected]: โš ๏ธ WARNING โš ๏ธ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar

[email protected] preinstall /home/ltu/Ethereum-tutorial/inbox/node_modules/scrypt
node node-scrypt-preinstall.js

[email protected] install /home/ltu/Ethereum-tutorial/inbox/node_modules/scrypt
node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/ltu/Ethereum-tutorial/inbox/node_modules/scrypt/build'
gyp ERR! System Linux 4.13.0-38-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 /home/ltu/Ethereum-tutorial/inbox/node_modules/scrypt
gyp ERR! node -v v9.10.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/ltu/.npm/_logs/2018-04-20T09_15_43_733Z-debug.log
Was this page helpful?
0 / 5 - 0 ratings

Related issues

connectdotz picture connectdotz  ยท  3Comments

praveengupta0895 picture praveengupta0895  ยท  3Comments

sundbry picture sundbry  ยท  3Comments

zamoore picture zamoore  ยท  3Comments

TinyWJL picture TinyWJL  ยท  3Comments