Web3.js 在 Windows 上安装错误

问题描述 投票:0回答:4

当我尝试安装 web3.js 时,出现此错误:

我的系统配置是:

Windows 7

节点:v6.11.0

npm:2010 年 10 月 3 日

npm i ethereum/web3.js --save

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url npm WARN addRemoteGit npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:204:12) npm WARN addRemoteGit     at emitTwo (events.js:106:13) npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7) npm WARN addRemoteGit     at maybeClose (internal/child_process.js:891:16) npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:342:11) npm WARN addRemoteGit     at emitOne (events.js:96:13) npm WARN addRemoteGit    at Socket.emit (events.js:188:7) npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:497:12) npm WARN addRemoteGit ethereum/web3.js resetting remote C:\Users\afeyzi\AppData\Roaming\npm-cache\_git-remotes\git-github-com-ethereum-web3-js-git-6339a8c5 because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url npm WARN addRemoteGit npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:204:12) npm WARN addRemoteGit     at emitTwo (events.js:106:13) npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7) npm WARN addRemoteGit     at maybeClose (internal/child_process.js:891:16) npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:342:11) npm WARN addRemoteGit     at emitOne (events.js:96:13) npm WARN addRemoteGit     at Socket.emit (events.js:188:7) npm WARN addRemoteGit     at Pipe._handle.close [as
_onclose] (net.js:497:12) npm WARN addRemoteGit   killed: false, npm WARN addRemoteGit   code: 1, npm WARN addRemoteGit   signal: null, npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }

node.js git npm web3js
4个回答
3
投票

使用以下命令安装 web3 以安装最新版本的 web3(当前为 1.0.0-beta.34)。

npm install web3

此外 --save 标签现在已被弃用,包将作为默认添加到依赖项中。要不在依赖项中包含包,请使用标签 --no-save。


0
投票

似乎由于 npm 包错误而导致 git 错误, 尝试一下

npm install --save [email protected]

或新版本

npm install --save [email protected]

您需要安装适用于 Windows 的 windows-build-tools

npm install --global --production windows-build-tools

0
投票

解决方案(Linux、Windown7、Windows10)

git 下载并安装

https://git-scm.com/downloads

然后,

c:\NodeJs ode_ethereum>npm install web3 --save

npm WARN 已弃用 [email protected]:在 Promise 支持下使用 mz 或 fs-extra^3.0 npm 警告已弃用 [email protected]: ??警告 ?? tar.gz 模块已被弃用,您的应用程序容易受到攻击。请改用 tar 模块:https://npmjs.com/tar npm WARN [email protected] 无描述 npm WARN [email protected] 没有存储库字段。

  • [email protected] 在 5.263 秒内更新了 1 个包并审核了 99531 个包 发现0个漏洞

祝你好运!

http://digital2u.co.kr/board/form/view/tip/916/1/55


0
投票

尝试像这样使用

sudo

sudo npm i web3

© www.soinside.com 2019 - 2024. All rights reserved.