简体   繁体   English

Raspberry Pi 4 上的 node-gyp 串行端口构建错误

[英]node-gyp serialport build error on Raspberry Pi 4

I have a nodejs electron app running on a Raspberry Pi 4. The latest raspberry pi OS will not build the application (and older OS versions will not run on the latest hardware.) I fairly sure this centers on the serialport package.我有一个在 Raspberry Pi 4 上运行的 nodejs electron 应用程序。最新的 raspberry pi 操作系统不会构建应用程序(并且较旧的操作系统版本不会在最新的硬件上运行。)我很确定这以串行端口serialport为中心。 I have tried building a bare-bones electron app with just the serialport package and it does not work either.我试过用串口 package 构建一个简单的serialport应用程序,但它也不起作用。 Is this a system configuration issue or package version(s)?这是系统配置问题还是 package 版本? I have tried Node 12, 14, & 16;我已经尝试过节点 12、14 和 16; serialport 9 & 10...?串行端口 9 和 10 ...?

I get the following error when doing npm i :执行npm i时出现以下错误:

> usb@2.5.0 install /home/myapp/myapp/node_modules/usb
> node-gyp-build

> lzma-native@8.0.6 install /home/myapp/myapp/node_modules/lzma-native
> node-gyp-build

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:308:12)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
gyp ERR! System Linux 5.15.56-v7l+
gyp ERR! command "/home/myapp/.config/nvm/versions/node/v12.22.12/bin/node" "/home/myapp/myapp/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/myapp/myapp/node_modules/lzma-native
gyp ERR! node -v v12.22.12
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN myapp-app@1.3.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: appdmg@0.4.5 (node_modules/appdmg):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for appdmg@0.4.5: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lzma-native@8.0.6 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the lzma-native@8.0.6 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/myapp/.npm/_logs/2022-08-26T13_57_08_118Z-debug.log

The error message is some string interpolation in a python script printing version info...错误消息是 python 脚本打印版本信息中的一些字符串插值...

After further investigating (using Node@16 & serialport@10), springing from this line:经过进一步调查(使用 Node@16 和 serialport@10),从这一行开始:

node-gyp -v v3.8.0

I installed node-gyp locally:我在本地安装了 node-gyp:

npm i node-gyp@latest -D

...and that clears this install error. ...这就清除了这个安装错误。 Other packages depend on older versions of node-gyp which is causing runtime problems but this particular issue is cleared...其他软件包依赖于导致运行时问题的较旧版本的node-gyp ,但此特定问题已被清除...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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