Closed goog closed 8 years ago
I have the same problem on node v4.2.1 and npm v2.14.7.
+1
+1
+1
+1
+1
+1
+1
+1
Thanks @doorbash, but I don't like, that it forks a new process for every setting using the cli tools. A real alternative could be i2c-bus . However, I implemented the crucial parts in C now and passing the results back to node later.
For anyone having this issue on the Raspberry Pi. It's an incompatibility between the I2C package and newer versions of Node.js. As a workaround you can install Node.js version 0.12.6 (which still works with the library) from here - http://node-arm.herokuapp.com/node_archive_armhf.deb
If the author doesn't fix this soon I'll fork it and get it running for Node >= 4.x as this package is starting to look abandoned...
@alphacharlie -- Please do!!!
@alphacharlie Oh Charlie, please do :-)
A fix would be appreciated, there's quite a few projects that depend on i2c and are now broken.
I forked the code off and updated it to use 'nan' for buffer creation. Will someone please try this and let me know how it works for them? https://github.com/alphacharlie/node-i2c
(Otherwise I'll have to put some hardware together to test it myself. Probably take a few days for me to get to it...)
For any developers who wish to test you would need to clone the repo into your project and install it manually. This would look something like-
cd ~
mkdir tmp
cd tmp
git clone [https://github.com/alphacharlie/node-i2c.git
cd [your project dir]
npm install --save ~/tmp/node-i2c/
This should put the new i2c package in your node_modules and package.json. You would also want to remove any reference to the i2c package on npmjs.com.
@alphacharlie
I have a setup laying in the office, I'll test it tomorrow and report back
I installed node 4.4.5 and then the newest version of node-i2c on a Rasperry 1 B and it failed. see: npm-debug.txt
@Maus34 - how exactly did you try to install it? (you would have to download it from the link above not from npm...) Try -
sudo apt-get update
sudo apt-get upgrade
mkdir tmp
cd tmp
git clone https://github.com/alphacharlie/node-i2c
npm install ./node-i2c
Note - I don't have a raspberry pi 1b to test with. But the above compiles and installs successfully for me on both Node 4.x and Node 6.x on the raspberry pi 2b. (Whether it actually works remains to be seen. I don't have the hardware set up to test it right now...)
@alphacharlie I tried it again with exactly the commands above ( new download to tmp, that I dont used before) see the last messages from the terminal mess.txt and the log file npm-debug.txt Maybe its a probem of rights
@Maus34 - Hmmm not sure what is going on... From your debug file it is trying to install it into ~/tmp/node_modules/i2c and failing. But from the commands I gave, it should just build in place in ~/tmp/node-i2c
Can you give more of the terminal output (mess.txt)? I think whatever the actual error was is probably 10-20 lines above what you\ posted...
@ Alphacharlie seems the c++11 compiler was not foud typescript.txt
@Maus34 - You might do -
sudo apt-get install build-essential
and try again.
Also, The code at https://github.com/alphacharlie/node-i2c has been updated. (I finished the conversion to the Nan module.) So anyone testing the fix will want to re-download it.
If it works for everybody I'll do a pull request and see if @kelly will merge it.
@alphacharlie
I checked with gcc --version
4.6.3
updated it to 4.8 (for C++11), search for: "raspberry c++11"
check with gcc --version
4.8
then it worked
@Maus34 - Huzzah!
If you get a chance to test it, please post back with any results... :-)
Hello All
Good News - Just got done testing this package on actual I2c hardware (ADS1015 ADC) and it worked for me without errors!
Looking for more developers to confirm that it also works for them. To test you can replace the dependency in the applicable Package.json file. So this:
"dependencies": {
"i2c": "^0.2.1"
},
becomes this:
"dependencies": {
"i2c": "https://github.com/alphacharlie/node-i2c"
}
then rebuild the your node app.
**Note - if you are an end user trying to fix a broken install, then you'll probably have to do -
npm install force
in your app directory, then go digging for the broken dependency. (or dependencies?) until the changes are merged.
@alphacharlie awesome! Thanks for putting this together and making the switch to Nan. Send me a PR when you have a chance. I'll look everything over and get it merged in.
@alphacharlie
I start my application with node app.js
for my node module node-HDC1000 and got the error
Cannot find module 'i2c'
@Maus34 - Can you post your package.json?