Web3.js: npm install web3

Created on 31 Mar 2019  路  6Comments  路  Source: ChainSafe/web3.js

Hi I was trying to install web3 but I got errors :/

c:Users\ikinc\truffle-part2>npm install web3

[email protected] preinstall c:Users\ikinc\node_modules\scrypt
node node-scrypt-preinstall.js

[email protected] install c:Users\ikinc\node_modules\scrypt
node-gyp rebuild

c:Users\ikinc\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:Users\ikinc\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:Users\ikinc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:Users\ikinc\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\ikinc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd c:Users\ikinc\node_modules\scrypt
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'c:Users\ikincpackage.json'
npm WARN ikinc No description
npm WARN ikinc No repository field.
npm WARN ikinc No README data
npm WARN ikinc No license 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! C:Users\ikinc\AppData\Roaming\npm-cache_logs\2019-03-31T14_07_30_412Z-debug.log

Versions

  • web3.js:
  • nodejs:
  • browser:
  • ethereum node:

Most helpful comment

This is not a problem with npm. Changing to a lower version of node -- node 8.10.0 -- worked for me.

All 6 comments

@ikincidemirel This is a problem with your npm not web3. Try reinstalling npm.

No, it's not a problem with npm (it all starts with one of the dependencies of this project: scrypt). This is the solution recommended by the main maintainer: https://github.com/ethereum/web3.js/issues/1783#issuecomment-405650471

@gangsthub

https://github.com/ethereum/web3.js/pull/2903

This solves it for me. Moving scrypt to an optional dependency seems to fix it

Thanks, Sebastian! Will try! ;)

This is not a problem with npm. Changing to a lower version of node -- node 8.10.0 -- worked for me.

This is not a problem with npm. Changing to a lower version of node -- node 8.10.0 -- worked for me.

Yes, I fixed it using npm 6.13.4, node v10.18.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webersson picture webersson  路  3Comments

FradSer picture FradSer  路  3Comments

TinyWJL picture TinyWJL  路  3Comments

joeriexelmans picture joeriexelmans  路  3Comments

connectdotz picture connectdotz  路  3Comments