web3 npm 安装失败

web3 npm install fails

我似乎在努力让 npm 安装 web3

使用的命令:

npm install web3

错误:

npm ERR! Path must be a string. Received undefined

日志:

 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 ]

我也用 root 用户试过 运行 它们。

问题可能来自使用 web3 的测试版,它目前不稳定,目前正在大力开发中,您有两个选择之一,

要么使用稳定版本 0.19,要么使用类似的版本。

我建议尝试的另一件事是 npm --save 以便在项目中本地保存包