node-gyp 在安装过程中失败 web3 scrypt@6.0.3 install: `node-gyp rebuild`

Posted

技术标签:

【中文标题】node-gyp 在安装过程中失败 web3 scrypt@6.0.3 install: `node-gyp rebuild`【英文标题】:node-gyp fails during installation web3 scrypt@6.0.3 install: `node-gyp rebuild` 【发布时间】:2020-03-19 15:30:04 【问题描述】:

我正在我的项目中运行 npm install,但中途运行失败。我已经按照this 的指导完成了工作,但我仍然无法让 node-gyp 正常工作。

我已安装 npm install --global --production windows-build-tools --vs2015 并安装了 python 2.6 并设置了路径,但我仍然无法通过 npm 安装过程

npm install --verbose 这就是我得到的

    22 Warning(s)
    47 Error(s)

Time Elapsed 00:00:10.17
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\USER\WebstormProjects\myApp\node_modules\scrypt
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm verb lifecycle scrypt@6.0.3~install: unsafe-perm in lifecycle true
npm verb lifecycle scrypt@6.0.3~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\USER\WebstormProjects\portal_frontend_au
th0\node_modules\scrypt\node_modules\.bin;C:\Users\USER\WebstormProjects\myApp\node_modules\.bin;C:\Program Files (x86)\MSBuild\14.0\Bin;C:\Users\USER\Envs\proje
cts\Scripts;C:\Users\USER\WebstormProjects\myApp\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Wi
ndows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Window
s Kits\8.1\Windows Performance Toolkit\;C:\Users\USER\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\USER\AppData\Local\Programs\Python\Python38-32\;C:\Users\USER\A
ppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\WebStorm 2019.2.4\bin;;C:\Users\USER\AppData\Roaming\npm
npm verb lifecycle scrypt@6.0.3~install: CWD: C:\Users\USER\WebstormProjects\myApp\node_modules\scrypt
npm info lifecycle scrypt@6.0.3~install: Failed to exec install script
npm timing action:install Completed in 32082ms
npm verb unlock done using C:\Users\USER\AppData\Roaming\npm-cache\_locks\staging-19dd7fb111b35106.lock for C:\Users\USER\WebstormProjects\myApp\node_modules\.st
aging
npm timing stage:rollbackFailedOptional Completed in 511ms
npm timing stage:runTopLevelLifecycles Completed in 47161ms
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted "os":"darwin","arch":"any" (current: "os":"win32","arch":"x64")
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted "os":"darwin","arch":"any" (current: "os":"win32","arch":"x64")
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted "os":"darwin","arch":"any" (current: "os":"win32","arch":"x64")
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64

npm verb stack Error: scrypt@6.0.3 install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:210:5)
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:210:5)
npm verb stack     at maybeClose (internal/child_process.js:1021:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
npm verb pkgid scrypt@6.0.3
npm verb cwd C:\Users\USER\WebstormProjects\myApp
npm verb Windows_NT 10.0.17763
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--verbose"
npm verb node v12.13.1
npm verb npm  v6.12.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 48860ms

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\USER\AppData\Roaming\npm-cache\_logs\2019-11-23T23_11_00_333Z-debug.log

【问题讨论】:

你能上传你的依赖吗?我遇到了类似的错误,但在 Linux 上。在我重新克隆它之前,我的 web3 项目也运行良好。 【参考方案1】:

2021/01/20 更新

作者已经推送了修复,安装它应该可以解决问题

npm install github:barrysteyn/node-scrypt#fb60a8d3c158fe115a624b5ffa7480f3a24b03fb


尝试用node版本v11安装。

【讨论】:

我可以验证节点 12 产生了 OP 的错误,但 v11 和 v8 都可以工作。如果您使用的是 nvm,您可以输入 nvm use 11,然后您的 npm 安装应该会通过。编辑:从 web3@1.2.6 开始就是这样

以上是关于node-gyp 在安装过程中失败 web3 scrypt@6.0.3 install: `node-gyp rebuild`的主要内容,如果未能解决你的问题,请参考以下文章

无法安装 aerospike,在“node-gyp 重建”步骤中使 aerospike 失败

安装 contextify 时出错-node-gyp 重建失败

npm install jquery 在 node-gyp 重建时失败

Windows npm install node-gyp 错误:libxslt 命令失败

Node-Gyp 在尝试安装 Brain.js 时返回错误

npm install loom-truffle-provider 因 node-gyp 与 scrypt 不兼容而失败