简体   繁体   中英

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 .

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:

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]

在此处输入图片说明

I checked the binding.vcxproj file and I see this line:

<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.

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.

I succeeded to install the package if I add the flag --ignore-scripts but it's ignore all the scripts from all the dependencies, is it ok?

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)?

Long time ago I've solved problem with node-gyp build but I don't remember how.

Here is what I use right now:

https://github.com/tBlabs/BluePill.Daemon/tree/master/add_to_node_modules

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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