【问题标题】:Installing "bluetooth-hci-socket" on raspberrypi v4.0?在 raspberrypi v4.0 上安装“bluetooth-hci-socket”?
【发布时间】:2021-03-10 20:46:38
【问题描述】:

尝试将 BLE 设备与 Raspberry PI 上的 nodejs 连接。它需要bluetooth-hci-socket 模块作为noble 模块的依赖项。这是我的错误日志。

pi@raspberrypi:~/bluetooth $ npm install bluetooth-hci-socket
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EAI_AGAIN: request to https://registry.npmjs.org/bluetooth-hci-socket failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.

> usb@1.6.3 install /home/pi/bluetooth/node_modules/usb
> prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.6
prebuild-install info looking for cached prebuild @ /home/pi/.npm/_prebuilds/e00ec3-usb-v1.6.3-node-v64-linux-arm.tar.gz
prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v64-linux-arm.tar.gz
prebuild-install WARN install getaddrinfo EAI_AGAIN github.com github.com:443
/home/pi/.config/nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: 5: /home/pi/.config/nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js: not found

> bluetooth-hci-socket@0.5.1 install /home/pi/bluetooth/node_modules/bluetooth-hci-socket
> node-gyp rebuild

/home/pi/.config/nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: 5: /home/pi/.config/nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js: not found
npm WARN y@1.0.0 No description
npm WARN y@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.6.3 (node_modules/usb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.6.3 install: `prebuild-install --verbose || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bluetooth-hci-socket@0.5.1 install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the bluetooth-hci-socket@0.5.1 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/pi/.npm/_logs/2020-11-28T07_32_21_944Z-debug.log

根据bluetooth-hci-socket 文档,我已经安装了所有依赖项node-gyp,python,g++

我怀疑这是节点版本冲突。谁能帮我解决这个问题?

【问题讨论】:

  • 有人帮助过你吗?我也有同样的问题。

标签: node.js bluetooth-lowenergy raspberry-pi4


【解决方案1】:

尝试安装@abandonware/noble@abandonware/bluetooth-hci-socket 而不是noblebluetooth-hci-socket

【讨论】:

  • 我遇到了同样的问题。改为安装 @abandonware/bluetooth-hci-socket 并且安装运行良好。但是,它似乎没有在我的 node_modules 文件夹中创建任何模块,并且 node.js 脚本仍然出现“找不到模块'bluetooth-hci-socket'”错误。关于我能做什么的任何想法!?
  • @DianaVallverdu 您可能需要修改一些 requireimport 行以要求或从 @abandonware/bluetooth-hci-socket 导入,以便节点搜索正确的包。您的 node_modules 中的文件应位于 node_modules/@abandonware/bluetooth-hci-socket IIRC 下。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-04-27
  • 1970-01-01
  • 1970-01-01
  • 2022-11-14
  • 2016-11-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多