我有一个nodejs电子应用程序在树莓派4上运行。最新的树莓派操作系统将不会构建应用程序(旧的操作系统版本将无法在最新的硬件上运行。)我相当肯定这集中在serialport
软件包上。我曾尝试用serialport
软件包构建一个基本的电子应用程序,但它也不起作用。这是系统配置问题还是软件包版本问题我已经试过节点12、14和16;串行端口9和10...?
我在执行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
错误消息是python脚本中的一些字符串插值打印版本信息...
1条答案
按热度按时间i5desfxk1#
在进一步调查之后(使用Node@16和serialport@10),从以下行中弹出:
node-gyp -v v3.8.0
我在本地安装了node-gyp:
npm i node-gyp@latest -D
...并清除此安装错误。其他软件包依赖于
node-gyp
的旧版本,这会导致运行时问题,但此特定问题已被清除...