繁体   English   中英

尝试npm安装web3时出现致命错误LNK1181

[英]Fatal error LNK1181 when trying to npm install web3

我正在尝试使用npm install安装web3节点软件包。 我知道以下事实:由于我正在运行Windows,因此我首先需要安装Windows构建工具:

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

该命令运行正常,但是当我运行命令安装web3时,出现以下错误:

npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated tar.gz@1.0.7: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
> scrypt@6.0.3 preinstall [project path]\node_modules\scrypt
> node node-scrypt-preinstall.js
> scrypt@6.0.3 install [project path]\node_modules\scrypt
> node-gyp rebuild
[project path]\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
[project path]\node_modules\scrypt\build\..\scrypt\win\include\config.h
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Copying scrypt/win/include/config.h to scrypt/scrypt-1.2.0/config.h
  The system cannot find the file specified.
  win_delay_load_hook.cc
LINK : fatal error LNK1181: cannot open input file '[user path]\.node-gyp\9.8.0\x64\node.lib' [[project path]\node_modules\scrypt\build\copied_files.vcxproj]
  memlimit.c
  keyderivation.c
  pickparams.c
  hash.c
  win_delay_load_hook.cc
  scrypt_wrapper.vcxproj -> [project path]\node_modules\scrypt\build\Release\\scrypt_wrapper.lib
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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 10.0.16299
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 [project path]\node_modules\scrypt
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN inbox@1.0.0 No description
npm WARN inbox@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
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 ERR! A complete log of this run can be found in:
npm ERR!     [user path]\AppData\Roaming\npm-cache\_logs\2018-03-16T15_29_59_737Z-debug.log

经过一些关于为什么会发生这种情况的进一步研究后,我发现在安装过程中尝试安装scrypt(?)时会弹出错误消息。 问题是什么? 我还添加了Windows构建工具设置后所需的python环境变量。

要解决此错误,请在项目属性的路径中使用无空格的路径或引号。

太抱歉了,因为我看不到正在发生的事情以及为什么它不起作用...

我已经尝试过,并且使用这种方法对我有用:

  1. npm install --global --production Windows构建工具
  2. npm install-保存web3@1.0.0-beta.26

并且正确安装了web 3 V 1.0。

如果其他人可以帮助;)

以超级用户或管理员身份运行可以解决此问题。 我有同样的错误。 我遵循Azerus的建议,并创建了仅包含拉丁字母且没有空格的新路径(实际上,我只是创建了新用户并登录)。 但是它仍然没有起作用,但是错误号有所不同。 然后我有了以管理员身份运行cmd的想法,并完成了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM