web3 npm install fails

Issue

I seem to be struggling with getting npm to install web3

Command used:

npm install web3

Error:

npm ERR! Path must be a string. Received undefined

Logs:

 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'web3' ]
2 info using npm@5.0.4
3 info using node@v8.1.3
4 verbose npm-session 02c74f27df35fda1
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/web3 236ms (from cache)
8 silly pacote tag manifest for web3@latest fetched in 269ms
9 verbose stack TypeError: Path must be a string. Received undefined
9 verbose stack     at assertPath (path.js:28:11)
9 verbose stack     at Object.relative (path.js:1248:5)
9 verbose stack     at computeVersionSpec (/usr/lib/node_modules/npm/lib/install/deps.js:282:27)
9 verbose stack     at Installer.normalizeCurrentTree (/usr/lib/node_modules/npm/lib/install.js:370:69)
9 verbose stack     at Array.<anonymous> (/usr/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
9 verbose stack     at LOOP (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
9 verbose stack     at /usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
9 verbose stack     at iferr (/usr/lib/node_modules/npm/lib/install.js:328:5)
9 verbose stack     at /usr/lib/node_modules/npm/node_modules/iferr/index.js:13:50
9 verbose stack     at cb (/usr/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
9 verbose stack     at /usr/lib/node_modules/npm/node_modules/call-limit/call-limit.js:22:12
9 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:95:7)
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:161:9)
10 verbose cwd /home/username
11 verbose Linux 4.11.7-1-ARCH
12 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "web3"
13 verbose node v8.1.3
14 verbose npm  v5.0.4
15 error Path must be a string. Received undefined
16 verbose exit [ 1, true ]

I’ve tried running them with root user as well.

Solution

The problem might come from using a beta version of web3 it’s not stable at the moment and currently is under heavy development you have one of two options,

either use a stable version 0.19 I think or something like that.

Another thing I would suggest trying is npm --save in order to save the package locally in the project

Answered By – Moe Elsharif

Answer Checked By – David Marino (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.