0

我似乎在努力让 npm 安装 web3

使用的命令:

npm 安装 web3

错误:

npm 错误!路径必须是字符串。收到未定义

日志:

 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 用户运行它们。任何帮助表示赞赏。

谢谢

4

1 回答 1

0

问题可能来自使用 web3 的 beta 版本,它目前不稳定,目前正在大量开发中,您有两种选择之一,

要么使用我认为的稳定版本 0.19 或类似的东西。

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

于 2017-09-19T11:20:51.060 回答