Nihiue / open-ip-kvm

Build your own open-source ip-kvm device
MIT License
412 stars 78 forks source link

npm install error #1

Closed lymanfan closed 1 year ago

lymanfan commented 1 year ago

ubuntu系统上npm install 时候提示如下错误是什么问题。[找到原因了, 换了nodejs 14.17.0的版本就没问题了] lyman@openvpn:~/open-ip-kvm$ npm install

@serialport/bindings-cpp@10.7.0 install /home/lyman/open-ip-kvm/node_modules/@serialport/bindings-cpp node-gyp-build

make: Entering directory '/home/lyman/open-ip-kvm/node_modules/@serialport/bindings-cpp/build' CXX(target) Release/obj.target/bindings/src/serialport.o CXX(target) Release/obj.target/bindings/src/serialport_unix.o CXX(target) Release/obj.target/bindings/src/poller.o ../src/poller.cpp: In static member function ‘static Napi::Object Poller::Init(Napi::Env, Napi::Object)’: ../src/poller.cpp:108:7: error: ‘class Napi::Env’ has no member named ‘SetInstanceData’ 108 | env.SetInstanceData(constructor); | ^~~~~~~ ../src/poller.cpp:108:46: error: expected primary-expression before ‘>’ token 108 | env.SetInstanceData(constructor); | ^ ../src/poller.cpp: In static member function ‘static Napi::Value Poller::New(const Napi::CallbackInfo&)’: ../src/poller.cpp:127:53: error: ‘class Napi::Env’ has no member named ‘GetInstanceData’ 127 | Napi::FunctionReference constructor = info.Env().GetInstanceData(); | ^~~~~~~ ../src/poller.cpp:127:92: error: expected primary-expression before ‘>’ token 127 | Napi::FunctionReference constructor = info.Env().GetInstanceData(); | ^ ../src/poller.cpp:127:94: error: expected primary-expression before ‘)’ token 127 | Napi::FunctionReference* constructor = info.Env().GetInstanceData(); | ^ make: * [bindings.target.mk:106: Release/obj.target/bindings/src/poller.o] Error 1 make: Leaving directory '/home/lyman/open-ip-kvm/node_modules/@serialport/bindings-cpp/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/share/nodejs/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Linux 5.4.0-132-generic gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /home/lyman/open-ip-kvm/node_modules/@serialport/bindings-cpp gyp ERR! node -v v10.19.0 gyp ERR! node-gyp -v v6.1.0 gyp ERR! not ok npm WARN open-ip-kvm@1.0.0 No repository field.**

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @serialport/bindings-cpp@10.7.0 install: node-gyp-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @serialport/bindings-cpp@10.7.0 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! /home/lyman/.npm/_logs/2022-11-30T09_57_37_198Z-debug.log lyman@openvpn:~/open-ip-kvm$

Nihiue commented 1 year ago

串口通信用到了这个库 https://github.com/serialport/ ,它通过 native binding 去调用os的能力,所以在安装时会编译这部分

而binding需要特定的node版本才能顺利编译, 太旧的或者太新的可能有问题