I've been trying to install web3 for the past few hours and it seems impossible. I've reinstalled nodejs various times, I even tried a fresh linux and I can't get it to install properly.
I used nvm in my last attempt, here's the output:
Ranguna@RANGUNAS-LAPTOP:~$ npm install -g web3
> [email protected] postinstall /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3
> lerna bootstrap
lerna info version 2.0.0
lerna info Bootstrapping 19 packages
lerna info lifecycle preinstall
lerna info Installing external dependencies
lerna ERR! execute Error: Command failed: npm install
lerna ERR! execute npm ERR! Can't install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-utils: Missing package name
lerna ERR! execute
lerna ERR! execute npm ERR! A complete log of this run can be found in:
lerna ERR! execute npm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_667Z-debug.log
lerna ERR! execute
lerna ERR! execute at Promise.all.then.arr (/home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/node_modules/execa/index.js:210:11)
lerna ERR! execute at <anonymous>
lerna ERR! execute at process._tickCallback (internal/process/next_tick.js:188:7)
lerna ERR! execute callback with error
lerna ERR! execute { Error: Command failed: npm install
lerna ERR! execute npm ERR! Can't install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-utils: Missing package name
lerna ERR! execute
lerna ERR! execute npm ERR! A complete log of this run can be found in:
lerna ERR! execute npm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_667Z-debug.log
lerna ERR! execute
lerna ERR! execute at Promise.all.then.arr (/home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/node_modules/execa/index.js:210:11)
lerna ERR! execute at <anonymous>
lerna ERR! execute at process._tickCallback (internal/process/next_tick.js:188:7)
lerna ERR! execute stack: 'Error: Command failed: npm install\nnpm ERR! Can\'t install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-utils: Missing package name\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_667Z-debug.log\n\n at Promise.all.then.arr (/home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/node_modules/execa/index.js:210:11)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:188:7)',
lerna ERR! execute code: 1,
lerna ERR! execute killed: false,
lerna ERR! execute stdout: '',
lerna ERR! execute stderr: 'npm ERR! Can\'t install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-utils: Missing package name\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_667Z-debug.log\n',
lerna ERR! execute failed: true,
lerna ERR! execute signal: null,
lerna ERR! execute cmd: 'npm install',
lerna ERR! execute timedOut: false }
lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately.
(node:8223) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Command failed: npm install
npm ERR! Can't install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-utils: Missing package name
npm ERR! A complete log of this run can be found in:
npm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_667Z-debug.log
(node:8223) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:8223) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: Command failed: npm install
npm ERR! Can't install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-eth-iban: Missing package name
npm ERR! A complete log of this run can be found in:
npm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_694Z-debug.log
(node:8223) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): Error: Command failed: npm install
npm ERR! Can't install /home/Ranguna/.nvm/versions/node/v8.2.1/lib/node_modules/web3/packages/web3-bzz: Missing package name
npm ERR! A complete log of this run can be found in:
npm ERR! /home/Ranguna/.npm/_logs/2017-07-28T16_25_07_773Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `lerna bootstrap`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall 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/Ranguna/.npm/_logs/2017-07-28T16_25_21_185Z-debug.log
I'm running under Xenial Bash on Ubuntu on Windows.
What am I doing wrong here ?
Are you trying to install the version 1.0 beta? Version 0.20.0 is considered the current stable version, so I'd recommend installing that one:
npm install web3@^0.20.0
Looks like I'm getting the same errors when I try to install the 1.0 beta.
Yep, 0.20.0 works 👍
But I just downgraded node to v4.8.4 and web3 1.0 beta installed successfuly:
Now using node v4.8.4 (npm v2.15.11)
Ranguna@RANGUNAS-LAPTOP:~/test$ npm install web3
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
\
> [email protected] postinstall /home/Ranguna/test/node_modules/web3
> lerna bootstrap
lerna info version 2.0.0
lerna info Bootstrapping 19 packages
lerna info lifecycle preinstall
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle postinstall
lerna info lifecycle prepublish
lerna success Bootstrapped 19 packages
[email protected] node_modules/web3
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
But I get an error when I try to require it:
EDIT: Upgraded nodejs to v6.11.1 and the errors are gone, the beta works !
> require("web3")
/home/Ranguna/test/node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/src/account.js:6
const {keccak256, keccak256s} = require("./hash");
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
>
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
> var a =require("web3")
/home/Ranguna/test/node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/src/account.js:6 Module._compile (module.js:409:26)
const {keccak256, keccak256s} = require("./hash");6:10)
^Module.load (module.js:343:32)
SyntaxError: Unexpected token {odule.js:300:12)
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)les/web3/packages/web3-eth/src/index.js: at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)dule.js:416:10)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/Ranguna/test/node_modules/web3/packages/web3-eth-accounts/src/index.js:29:15)equire (module.js:353:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)les/web3/src/index.js:34:11)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/Ranguna/test/node_modules/web3/packages/web3-eth/src/index.js:36:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/Ranguna/test/node_modules/web3/src/index.js:34:11)
>
Nevertheless my problem has been resolved, this issue can be closed.
Thank you !
I think you should not run web3 on any version of node less than 6 really what i recommend is to use 1.0.0-beta.13, it works for me fine
Will do, thanks !
I hope this is fixed with the new beta.15
FWIW, I'm experiencing this same error in Ubuntu 17.04 with node v8.2.1 trying to install beta.18.
@spalladino Install node 6 and try the beta again.
Using node 8 work.
I'm running against the same problem :/
Node v8.4.0 and [email protected]
Anybody got any ideas?
@leonardoalt Try Node v6 or web3 v0.20.0 and see if it works.
I'm reporting the same issue here : https://github.com/ethereum/web3.js/issues/950#issuecomment-329751532
With ubuntu 17.04, node 8.4.0 and npm 5.4.2
Most helpful comment
Are you trying to install the version 1.0 beta? Version 0.20.0 is considered the current stable version, so I'd recommend installing that one:
npm install web3@^0.20.0Looks like I'm getting the same errors when I try to install the 1.0 beta.