我尝试在serialport
期间将软件包oxygen-cli
(即npm install -g serialport
的依赖项)安装到我们的内部网络而无法访问互联网重建node-gyp
。
我遇到一个错误并解决了另一个错误,等等。现在我坚持了这个错误:
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
serialport.cpp
serialport_win.cpp
win_delay_load_hook.cc
C:\Users\yehoshaa\AppData\Roaming\npm\node_modules\serialport\node_modules\nan\nan.h(24): fatal error C1083: Cannot open include file: 'node_version.h': No such file or directory (compiling source file ..\s
rc\serialport_win.cpp) [C:\Users\yehoshaa\AppData\Roaming\npm\node_modules\serialport\node_modules\@serialport\bindings\build\bindings.vcxproj]
C:\Users\yehoshaa\AppData\Roaming\npm\node_modules\serialport\node_modules\nan\nan.h(24): fatal error C1083: Cannot open include file: 'node_version.h': No such file or directory (compiling source file ..\s
rc\serialport.cpp) [C:\Users\yehoshaa\AppData\Roaming\npm\node_modules\serialport\node_modules\@serialport\bindings\build\bindings.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` 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:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248: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 C:\Users\yehoshaa\AppData\Roaming\npm\node_modules\serialport\node_modules\@serialport\bindings
当我尝试仅运行node-gyp rebuild
时,出现此错误:
LINK:致命错误LNK1104:无法打开文件'C:\ Users \ myuser \ AppDate \ Roaming \ npm \ Release \ node.lib'[C:\ Users \ myuser \ AppData \ Roaming \ npm \ node_modules \ node- gyp \ build \ binding.vcxproj]
我检查了binding.vcxproj
文件,并看到以下行:
<AdditionalDependencies>C:\Users\myuser\AppData\Roaming\npm\$(Configuration)\node.lib</AdditionalDependencies>
我试图在机器中搜索node.lib
,但没有找到。
如果我从文件中删除此行并运行node-gyp build
,它可以工作,但是因为我必须rebuild
用有问题的行再次下载文件。
--ignore-scripts
,我就成功安装了该软件包,但是它会忽略所有依赖项中的所有脚本,可以吗?您知道如何解决吗?或如何安装sertialport
无来完成node-gyp rebuild
(仅忽略此脚本而不忽略所有依赖项脚本)?
答案 0 :(得分:0)
很久以前,我已经解决了node-gyp构建的问题,但是我不记得怎么做。
这是我现在使用的:
https://github.com/tBlabs/BluePill.Daemon/tree/master/add_to_node_modules