node-red-contrib-i2c icon indicating copy to clipboard operation
node-red-contrib-i2c copied to clipboard

Does not compile under nodejs 12.x.

Open unixbigot opened this issue 5 years ago • 5 comments

Generates lots of warnings under node v10 (but works). Fails to build at all on node v12.

(Tested on raspbian buster, and node 12.13.0)

unixbigot avatar Nov 04 '19 08:11 unixbigot

I have installed it successfully under node v12 on raspbian buster. If you try to install it directly from npm (npm install node-red-contrib-i2c), it generates a lots of warnings because npm package v 0.5.2 tries to be installed. This version has a bug (missing ")") which was solved in version 0.5.5.

Try to install directly from github with this command, until npm package be updated to the last version. @nielsnl68 npm install https://github.com/nielsnl68/node-red-contrib-i2c.git

Generates lots of warnings under node v10 (but works). Fails to build at all on node v12.

(Tested on raspbian buster, and node 12.13.0)

jatg81 avatar Nov 09 '19 00:11 jatg81

thanks jatg81, your solution also works with buster + node.js 13.3.0 + node-red 1.0.3

VogelP avatar Dec 07 '19 16:12 VogelP

For what it is worth, ran into same issue with using version 0.5.2 from the node-red palette manager. used the git version directly and it works now on: node -v v12.14.0 npm -v 6.13.4 and this on buster with a raspberry 3 B+ I hope they push new version shortly to npm central repository

den-dog avatar Jan 03 '20 21:01 den-dog

@jatg81 Thank you for the solution! All works fine on

  • uname -a: Linux myPiMozilla 4.19.93-v7+ #1290 SMP Fri Jan 10 16:39:50 GMT 2020 armv7l GNU/Linux
  • node -v: v12.14.1
  • npm -v: 6.13.7

rei-vilo avatar Feb 06 '20 16:02 rei-vilo

I hope digging this old thread is ok. I decided to refresh my RPi B rev 2 (ARMv6). I've installed latest RPi OS and wanted to go with docker and IOTstack, but it failed in so many ways I gave up. Now I'm trying to install Node-RED and all my nodes to run my flows again and have few issues, i2c is one of them.

I've tried npm install (whole package for node-red), npm install i2c and also mentioned above npm install https://github.com/nielsnl68/node-red-contrib-i2c.git, the result is always the same: dozens of screens with errors (small excerpt below)

...
/home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2709:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:107:
../src/./writequick.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE WriteQuickSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/./writequick.cc:60:32: error: no matching function for call to ‘v8::Value::Int32Value()’
   int fd = info[0]->Int32Value();
                                ^
In file included from /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:67,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2709:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2709:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:107:
../src/./writequick.cc:61:34: error: no matching function for call to ‘v8::Value::Int32Value()’
   __u8 bit = info[1]->Int32Value();
                                  ^
In file included from /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:67,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2709:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2709:40: note:   candidate expects 1 argument, 0 provided
make: *** [i2c.target.mk:111: Release/obj.target/i2c/src/i2c.o] Error 1
make: Leaving directory '/home/pi/.node-red/node_modules/i2c-bus/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.4.72+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/i2c-bus
gyp ERR! node -v v12.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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-06T22_53_05_702Z-debug.log

node v12.19.0 npm 6.14.8

Is my RPi too old for node v12? Or is it something else? 4 days of fighting so any clue will be appreciated. Thanks

Marooned-MB avatar Nov 06 '20 23:11 Marooned-MB