我正在尝试通过 aws-iot-sdk-js-v2 连接到 AWS IoT Core,并在运行PubSub 示例时收到以下错误,如下所述:
/home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/native/binding.js:60
throw new Error("AWS CRT binary not present in any of the following locations:\n\t" + search_paths.join('\n\t'));
^
Error: AWS CRT binary not present in any of the following locations:
/home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/bin/native/aws-crt-nodejs
/home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/bin/linux-arm/aws-crt-nodejs
at Object.<anonymous> (/home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/native/binding.js:60:11)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/native/crt.js:22:35)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
我有一个树莓派 3B+
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
- 节点:14.15.3
- aws-iot-device-sdk-v2:1.5.2
- aws-crt:1.8.1
我在这里尝试了aws-iot-device-sdk-js-v2 #119的解决方案,但没有任何帮助。
我按照AWS IoT 中的描述按照onnecting-to-existing-device进行操作,但仍然会发生此错误。
在尝试按以下顺序安装和更新后,我运行的命令(删除所有是我的 raspi 上的服务后的顺序) :
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake
sudo apt-get install libssl-dev
sudo apt-get install -y nodejs
restarted by sudo shutdown -r 0
cd ~
npm install aws-crt
npm install aws-iot-device-sdk-v2
cd ~
git clone https://github.com/aws/aws-iot-device-sdk-js-v2.git
cd ~/aws-iot-device-sdk-js-v2
npm install
cd ~
mkdir certs
(I copied the certs and changed the name accordingly...)
cd ~/aws-iot-device-sdk-js-v2/samples/node/pub_sub
npm install
node dist/index.js --topic topic_1 --root-ca ~/certs/Amazon-root-CA-1.pem --cert ~/certs/device.pem.crt --key ~/certs/private.pem.key --endpoint <endpoint>
(I swap the <endpoint> with my own....)
顺便说一下 aws-iot-device-sdk-python-v2 的 工作原理,但我更喜欢使用 node.js SDK ...
我在 aws-iot-device-sdk-js-v2 上打开了一个新问题,但我仍在等待答案。
请帮忙。