electron使用原生node-serialport模块

发布于 2022-09-04 08:37:02 字数 3112 浏览 10 评论 0

在electron中打算调用原生node-serialport模块,使用electron-rebuild重新编译,按照electron官方手册的说明,使用:

export npm_config_target=1.4.3
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://atom.io/download/atom...
export npm_config_runtime=electron
export npm_config_build_from_source=true
HOME=~/.electron-gyp npm install

./node_modules/.bin/electron-rebuild

进行build。

显示错误信息如下:


electron-prebuilt@0.36.12 postinstall /usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/electron-prebuilt
node install.js

nslog@3.0.0 install /usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/nslog
node-gyp rebuild

gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! stack at Error (native)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/.3.10.8@npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/.3.0.0@nslog
gyp ERR! node -v v4.4.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/.3.10.8@npm/bin/npm-cli.js" "rebuild" "--runtime=electron" "--target=0.36.12" "--arch=x64"
npm ERR! node v4.4.3
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! nslog@3.0.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nslog@3.0.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nslog package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nslog
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nslog
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/npm-debug.log

Process exited with code: 1
Error: Process exited with code: 1

at ChildProcess.<anonymous> (/usr/local/lib/node_modules/.electron-rebuild_npminstall/node_modules/.1.2.1@electron-rebuild/lib/spawn.js:55:26)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:477:12)

请问是什么样问题会导致这种现象?应该怎样解决?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撧情箌佬 2022-09-11 08:37:02

hi,这个问题你解决没有?我最近也做一个物联网应用,技术选型也有这个。
看报错,你的貌似是权限问题额。。
这是网上查到的:https://discuss.atom.io/t/nod...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文