Hi team,
I moved this from here: https://github.com/MicrosoftDocs/azure-docs.ja-jp/issues/2913
The comment below was machine translated
@masakinoda111 commented 2 days ago
Connect Raspberry Pi to Azure IoT Hub (Node.js)
Running the sample application
When I tried, I got the following error.
pi@raspberrypi:~/iot-hub-node-raspberrypi-client-app $ sudo node index.js 'HostName=test1011musuke.azure-devices.net;DeviceId=raspi;SharedAccessKey=fS6c2LUT1sIb6nWZbnig8rd9L+sdJzz8muecMhKKNBs='
/home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/Debug/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/Release/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/out/Debug/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/Debug/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/out/Release/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/Release/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/default/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/compiled/10.17.0/linux/arm/nodeWiringPi.node
at bindings (/home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/node_modules/bindings/bindings.js:88:9)
at Object. (/home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/index.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/pi/iot-hub-node-raspberrypi-client-app/index.js:10:13)
I'm not sure what the error means, but how can I fix it?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@masakinoda111 I'm sorry to hear that you are facing this issue. There is a Pull Request that has a fix for this you could grab the code from there or just make the changes on your local https://github.com/Azure-Samples/iot-hub-node-raspberrypi-client-app/pull/26
You can see the changes here https://github.com/Azure-Samples/iot-hub-node-raspberrypi-client-app/pull/26/files I will test and merge the PR but it should work. Please let me know how it goes.
Hi @masakinoda111 did you have a chance to try the changes on the PR I linked to? did that resolve your issue?
変更を試してみましたが状況は変わらず、以下のようなエラーが発生します。
/home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/Debug/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/Release/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/out/Debug/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/Debug/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/out/Release/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/Release/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/default/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/compiled/10.17.0/linux/arm/nodeWiringPi.node
at bindings (/home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/node_modules/bindings/bindings.js:88:9)
at Object.
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.
Hi @masakinoda111 I was able to clear that error by doing
sudo apt-get install wiringpi
followed by:
npm install node-wiring-pi
Can you please try that?
試してみましたが同様のエラーが発生します。
updateがあったようなので以下を実行しました。
sudo npm install -g npm
そして、もう一度試しましたが、やはり同様のエラーが発生します。
仕方がないのでNode.jsは諦め、現在はPythonでチュートリアルを進めています。
ご対応いただきありがとうございました。
====Used Bing Translator====
I tried it and get a similar error.
Because there seemed to be an update, I did the following.
sudo npm install -g npm
And i've tried it again, but I still get a similar error.
Node.js gave up because there is no other way, and now we are proceeding with tutorials in Python.
Thank you for your support.
Thank you for your feedback @masakinoda111 , if you try using Node.js again, please follow Alberto's suggestion and let us know if you were not successfull.
We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.
Adding that I am getting the same error when I follow this document:
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-node-get-started
When I try to connect using my connection string, I get the bindings error described above.
I have tried the steps described above
Why did you close this thread without resolving the issue?
yeah having the exact same issue.
@CeciAc @Alberto-Vega this problem still exists. i bought a new rpi 3 and also try it on a rpi4 please assist to solve these issue. it is very bad to see that people wants to use azure but stuck on it.
Since this has been an ongoing issue and I've tried all solutions others have had I'm going to abandon the node.js route and try the instructions for C
MARCH 9 2020... AND THIS IS STILL A PROBLEM !!!
NO idea why this topic was CLOSED when CLEARLY people were having SO MANY problems they were ABANDONING this (node.js-based) sample application and instead openly TELLING you they were going to try the C-based version...
IS "I'm ABANDONING YOUR CODE BECAUSE YOU REFUSE TO FIX IT IN A TIMELY
FACT: it's behaviors JUST LIKE THIS that convince new users that Microsoft ISN'T SERIOUS about IoT, so they end up going with OTHER cloud-service provides (you know who) - STOP SCREWING AROUND MICROSOFT !
THAT SAID, here it is MARCH 9th, and I just purchased several BRAND-NEW CanaKits with Raspberry Pi 4 units in them.
CONFIGURATION & READYING these new units has been completely FLAWLESS... UNTIL it came time to RUN YOUR SAMPLE APP.
I get the SAME error message as many other people who AREN'T bothering to post requests-for-fixes because of this team's foolish-interpretation-of-leaving-threads-as-all's-well...
HERE is the beginning of my output (with my key deliberately polluted):
pi@thing1:~/iot-hub-node-raspberrypi-client-app $ sudo node index.js 'HostName=fakehostname.azure-devices.net;DeviceId=thing1;SharedAccessKey=+B0cnSCQnoofcoursethis-isn'tmyrealkeypmXkHuo='
/home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
WHAT IS REALLY GOING ON ???
This is a PRISTINE brand-new Raspberry Pi 4 running Raspbian as of March 7th 2020.
I've tried EVERY suggested change I could find thus far on these forums - so far NO LUCK getting it to work, but I'm NOT going to try the C-based version. I'm going to STAY (doggedly) with this nodejs-based version UNTIL IT GETS RESOLVED FOR EVERYONE WITH EQUIPMENT NEWER THAN SUMMER 2019 !!!
PLEASE MICROSOFT FIX YOUR STUFF - THIS IS MORE IMPORTANT THAN EVER IN 2020.
-Mark in North Aurora IL
UPDATE MARCH 9th 2020...
IF you're new to Raspberry Pi's and Azure IoT, then you're discovering:
THAT SAID, I'm committed to trying to RESOLVE this issue, AND EXPLAIN what's going on...
IF you did what I did (buy a NEW Pi4 kit from Amazon, meticulously follow EVERY STEP in the Microsoft Docs), and YOU TOO got this error in your Raspbian Terminal's window:
Error: Could not locate the bindings file. Tried:
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/Debug/nodeWiringPi.node
...
...
THIS WAS MY FIRST "RED HERRING" - that (stupidly) AMBIGUOUS error message !
THEN the error message starts to make SENSE:
BRIEF-BUT-USEFUL HISTORY LESSON...
WHICH BEGS THE QUESTION: WHY ISN'T there a "nodeWiringPi.node" file anywhere?
ANSWER:
This file was SUPPOSED to be actually BUILT on-the-fly when you executed the following commands:
1. THIS command "clones" (creates a local-on-the-Pi4) the sample app's SOURCE CODE:
$ git clone https://github.com/Azure-Samples/iot-hub-node-raspberrypi-client-app
- note: this INCLUDES the nodeWiringPi source code as well (the .node needs to be BUILT)
IF you WATCH this commands execution output, you'll see:
NO nodeWiringPi.node file means SAMPLE APP THROWS ERRORS when running !
THIS BEGS THE QUESTION: WHY ISN'T the nodeWiringPi.node file BUILDING ???
I'm STILL working on THAT (wasn't EXPECTING to be troubleshooting the BULLETPROOF SAMPLE APPS FROM MICROSOFT)...
THAT SAID, others HAVE had success MANUALLY installing & building ONLY nodeWiringPi using the following commands:
sudo apt-get install wiringpi <---- THIS command uses Raspbian's apt programm to GET the LINUX ("application") package "wiringpi" as a necessary starting point...
and
npm install node-wiring-pi <---- THIS command ultimately BUILDS the nodeWiringPi.node file, but THIS command will throw the SAME ERRORS as the other .node-building-command above, so...
NEXT I'm going to FIGURE OUT HOW TO GET A GOOD nodeWiringPi.node BUILD
BACK SOON...
-Mark in North Aurora
ps: I'm HOPING there are some people SO annoyed and SO discouraged in trying to get this "dang" sample app working that they find VALUE in the posting I'm providing. Please let me know?
-Mark
@CeciAc @Alberto-Vega this problem still exists. i bought a new rpi 3 and also try it on a rpi4 please assist to solve these issue. it is very bad to see that people wants to use azure but stuck on it.
You & I are in complete agreement.
DON'T UPLOAD sample applications that DON'T work and you're NOT SUPPORTING...
TRYING to decide if we're (my teammates & I) are going to:
a. keep beating our heads against the wall making node.js (javascript approach) work; OR
b. switch over to PYTHON (which we like better anyways)
ME?
Time is MONEY... so it's off to PYTHON land for Raspberry Pi4-to-AzureIoTHub connectivity :-)
Holy $%@# Mark, you figured it out. Thanks a lot. I've been trying to fix this for a week or two. The 2 commands you mentioned above:
Fixed my problem. Up arrowed to my statement "sudo node index.js ...." and it started sending to Azure.
Cheers to your for persistence and ownership!
We just updated the US version of this topic. Others should be updated soon. An updated sample has been provided to clear up most if not all the issues with the old stale sample.
Updated English US version of the topic:
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-node-get-started
Most helpful comment
UPDATE MARCH 9th 2020...
IF you're new to Raspberry Pi's and Azure IoT, then you're discovering:
(including me) really really aggravated.
THAT SAID, I'm committed to trying to RESOLVE this issue, AND EXPLAIN what's going on...
IF you did what I did (buy a NEW Pi4 kit from Amazon, meticulously follow EVERY STEP in the Microsoft Docs), and YOU TOO got this error in your Raspbian Terminal's window:
Error: Could not locate the bindings file. Tried:
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/nodeWiringPi.node
→ /home/pi/iot-hub-node-raspberrypi-client-app/node_modules/node-wiring-pi/build/Debug/nodeWiringPi.node
...
...
THIS WAS MY FIRST "RED HERRING" - that (stupidly) AMBIGUOUS error message !
'Could not locate a .node file specified in one of the bindings files. Tried looking in the following common paths:\n' +
THEN the error message starts to make SENSE:
BRIEF-BUT-USEFUL HISTORY LESSON...
WHICH BEGS THE QUESTION: WHY ISN'T there a "nodeWiringPi.node" file anywhere?
ANSWER:
This file was SUPPOSED to be actually BUILT on-the-fly when you executed the following commands:
1. THIS command "clones" (creates a local-on-the-Pi4) the sample app's SOURCE CODE:
$ git clone https://github.com/Azure-Samples/iot-hub-node-raspberrypi-client-app
- note: this INCLUDES the nodeWiringPi source code as well (the .node needs to be BUILT)
$ cd iot-hub-node-raspberrypi-client-app
$ npm install <-- this is the NodePackageManager command which BUILDS .node files !!
IF you WATCH this commands execution output, you'll see:
NO nodeWiringPi.node file means SAMPLE APP THROWS ERRORS when running !
THIS BEGS THE QUESTION: WHY ISN'T the nodeWiringPi.node file BUILDING ???
I'm STILL working on THAT (wasn't EXPECTING to be troubleshooting the BULLETPROOF SAMPLE APPS FROM MICROSOFT)...
THAT SAID, others HAVE had success MANUALLY installing & building ONLY nodeWiringPi using the following commands:
sudo apt-get install wiringpi <---- THIS command uses Raspbian's apt programm to GET the LINUX ("application") package "wiringpi" as a necessary starting point...
and
npm install node-wiring-pi <---- THIS command ultimately BUILDS the nodeWiringPi.node file, but THIS command will throw the SAME ERRORS as the other .node-building-command above, so...
NEXT I'm going to FIGURE OUT HOW TO GET A GOOD nodeWiringPi.node BUILD
BACK SOON...
-Mark in North Aurora
ps: I'm HOPING there are some people SO annoyed and SO discouraged in trying to get this "dang" sample app working that they find VALUE in the posting I'm providing. Please let me know?
-Mark