我已经能够使用串行口运行一个node.js应用程序。现在试图将它移植到电子平台上,以便跨平台使用。“'npm安装序列化端口”产生了以下结果:
serialport@2.0.5 install /Users/ylh/0/electron/electron-quick-start-master/node_modules/serialport
node-pre-gyp install --fallback-to-build
CXX(target) Release/obj.target/serialport/src/serialport.o
CXX(target) Release/obj.target/serialport/src/serialport_unix.o
CXX(target) Release/obj.target/serialport/src/serialport_poller.o
SOLINK_MODULE(target) Release/serialport.node
COPY /Users/ylh/0/electron/electron-quick-start-master/node_modules/serialport/build/Release/node-v47-darwin-x64/serialport.node
TOUCH Release/obj.target/action_after_build.stamp
electron-prebuilt@0.34.3 postinstall /Users/ylh/0/electron/electron-quick-start-master/node_modules/electron-prebuilt
node install.js当我用电子运行这个应用程序时,弹出窗口会抱怨
The app provided is not a valid electron app, please read the docs on how to write one:
https://github.com/atom/electron/tree/master/docs
Error: Cannot find module '/Users/ylh/0/electron/electron-quick-start-master/node_modules/serialport/build/Release/node-v46-darwin-x64/serialport.node'当然,node_modules目录中的版本是节点-v47-达尔文-x64。我不知道npm安装为什么会构建v47,但却希望运行v46。
发布于 2015-11-19 14:46:21
export npm_config_disturl=https://atom.io/download/atom-shell
export npm_config_target=0.34.3
export npm_config_arch=x64
export npm_config_runtime=electron
HOME=~/.electron-gyp npm install serialport在这之后,去/Users/ylh/0/electron/electron-quick-start-master/node_modules/serialport/build/Release/
并将electron-0.34-darwin-x64重命名为node-v46-darwin-x64
https://stackoverflow.com/questions/33796916
复制相似问题