当前位置: 移动技术网 > IT编程>开发语言>JavaScript > Electron npm install 常见错误(Windows)

Electron npm install 常见错误(Windows)

2019年07月16日  | 移动技术网IT编程  | 我要评论
问题一:node_gyp使用版本不对 问题:明明装的是5.0.2版本,使用的却是3.9.2版本。 原因:命令上已经写明,在npm_config_node_gyp未配置情况,node_gyp使用的版本。 解决:删掉前者路径的node-gyp。 问题二:无法找到 v140 的生成工具 问题:依赖的c++ ...

问题一:node_gyp使用版本不对

if not defined npm_config_node_gyp (node "c:\users\administrator\appdata\roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "c:\users\administrator\appdata\roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )

问题:明明装的是5.0.2版本,使用的却是3.9.2版本。

原因:命令上已经写明,在npm_config_node_gyp未配置情况,node_gyp使用的版本。

解决:删掉前者路径的node-gyp。

问题二:无法找到 v140 的生成工具

c:\program files (x86)\microsoft visual studio\2017\buildtools\common7\ide\vc\vctargets\microsoft.cpp.platform.targets(6
7,5): error msb8020: 无法找到 v140 的生成工具(平台工具集 =“v140”)。若要使用 v140 生成工具进行生成,请安装 v140 生成工具。或者,可以升级到当前 visual studio 工具,方式是通过选择
“项目”菜单或右键单击该解决方案,然后选择“重定解决方案目标”。 [f:\project\electron-source\node_modules\better-sqlite3\build\deps\locate_sqlite3.vcxpr
oj]
gyp err! build error
gyp err! stack error: `c:\program files (x86)\microsoft visual studio\2017\buildtools\msbuild\15.0\bin\msbuild.exe` failed with exit code: 1
gyp err! stack     at childprocess.onexit (c:\users\administrator\appdata\roaming\npm\node_modules\node-gyp\lib\build.js:190:23)
gyp err! stack     at childprocess.emit (events.js:182:13)
gyp err! stack     at process.childprocess._handle.onexit (internal/child_process.js:237:12)
gyp err! system windows_nt 10.0.17134
gyp err! command "c:\\program files\\nodejs\\node.exe" "c:\\users\\administrator\\appdata\\roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp err! cwd f:\project\electron-source\node_modules\better-sqlite3
gyp err! node -v v10.3.0
gyp err! node-gyp -v v5.0.2
gyp err! not ok

问题:依赖的c++插件库,总是编译出错,报没有v140工具。

原因:缺少 visual studio v140工具。

解决:

1、去到 c:\program files (x86)\microsoft visual studio\installer 目录。

2、打开 visual studio installer 工具。

3、安装 msvc v140 - vs 2015 c++ 生成工具(v14.00) 工具。

问题三:this is a bug in `node-pre-gyp`

node-pre-gyp err! completion callback never invoked!
node-pre-gyp err! system windows_nt 10.0.17134
node-pre-gyp err! command "c:\\program files\\nodejs\\node.exe" "f:\\project\\electron-source\\node_modules\\@journeyapps\\sqlcipher\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp err! cwd f:\project\electron-source\node_modules\@journeyapps\sqlcipher
node-pre-gyp err! node -v v10.3.0
node-pre-gyp err! node-pre-gyp -v v0.10.0
node-pre-gyp err! this is a bug in `node-pre-gyp`.
node-pre-gyp err! try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp err!     <https://github.com/mapbox/node-pre-gyp/issues>

问题:执行到node-pre-gyp总是报错。

原因:未知。

解决:重启下电脑,就可以了…… 

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网