[英]Can't npm install serialport (or 'node-gyp rebuild') offline
I try to install the package serialport
(that is dependency of oxygen-cli
) in our internal network without access to the internet during the npm install -g serialport
he tries to rebuild node-gyp
.在npm install -g serialport
他尝试重建node-gyp
npm install -g serialport
期间,我尝试在我们的内部网络中安装包serialport
(即oxygen-cli
依赖项)而无需访问互联网。
I got an error and I solved it, and another error etc. Now I stuck with this error:我遇到了一个错误,我解决了它,还有另一个错误等等。现在我遇到了这个错误:
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
When I try to run only node-gyp rebuild
I got this error:当我尝试仅运行node-gyp rebuild
,出现此错误:
LINK: fatal error LNK1104: cannot open file 'C:\\Users\\myuser\\AppDate\\Roaming\\npm\\Release\\node.lib' [C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\build\\binding.vcxproj]链接:致命错误 LNK1104:无法打开文件 'C:\\Users\\myuser\\AppDate\\Roaming\\npm\\Release\\node.lib' [C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\build \\binding.vcxproj]
I checked the binding.vcxproj
file and I see this line:我检查了binding.vcxproj
文件,我看到了这一行:
<AdditionalDependencies>C:\Users\myuser\AppData\Roaming\npm\$(Configuration)\node.lib</AdditionalDependencies>
I tried to search the node.lib
in my machine but I didn't find it.我试图在我的机器中搜索node.lib
但我没有找到它。
If I remove this line from the file and run node-gyp build
it works, but because I must to do rebuild
the file downloaded again with the problematic line.如果我从文件中删除这一行并运行node-gyp build
它可以工作,但是因为我必须使用有问题的行rebuild
再次下载的文件。
--ignore-scripts
but it's ignore all the scripts from all the dependencies, is it ok?如果我添加了--ignore-scripts
标志,我就成功安装了该软件包,但它忽略了所有依赖项中的所有脚本,可以吗? Do you know how to solve it?你知道如何解决吗? or how to install sertialport
without to do node-gyp rebuild
(to ignore only this script but not all the dependencies scripts)?或者如何在不进行node-gyp rebuild
sertialport
node-gyp rebuild
情况下安装sertialport
(仅忽略此脚本而不是所有依赖项脚本)?
Long time ago I've solved problem with node-gyp build but I don't remember how.很久以前,我已经解决了 node-gyp build 的问题,但我不记得是如何解决的。
Here is what I use right now:这是我现在使用的:
https://github.com/tBlabs/BluePill.Daemon/tree/master/add_to_node_modules https://github.com/tBlabs/BluePill.Daemon/tree/master/add_to_node_modules
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.