Sudo npm install node-red-contrib-oled - Errors

Hi Folks

Starting out with Node Red on raspberry pi 4. Have been using sbc's and micro controllers for may years. have setup NR as per the instructions on nodered docs getting-started raspberrypi

Looking to build up a senor that will report via a MQTT broker, using an example from LXF259 "build a smart thermal monitor"

Building flows etc appears to be ok however upon attempting to install OLED support (among other things) I am consistency getting errors that look to me like the environment is not setup correctly. I have included the entire response obtained when i enter the command in the subject line above.

I believe there is an issue with OLED however I receive the same error when trying to install DHT this way as well. I was able to add DHT via managing the palette.

I was not able to include the entire output, pls me know if I need to provide more

Any assistance greatly appreciated

Welcome to Node-RED

13 Jul 11:33:11 - [info] Node-RED version: v1.1.2
13 Jul 11:33:11 - [info] Node.js version: v12.18.2

sudo npm install node-red-contrib-oled

ependent() [with T = v8::Object]’ is deprecated: Weak objects are always considered independent. Use TracedGlobal when trying to use EmbedderHeapTracer. Use a strong handle when trying to keep an object alive. [-Wdeprecated-declarations]
persistent().MarkIndependent();
^

/tmp/.node-gyp/12.18.2/include/node/v8.h:570:22: note: declared here
V8_INLINE void MarkIndependent());
^~~~~~~~~~~~~~~

It might be worthwhile raising an issue on their github page, however, since there haven't been any code changes for quite a while, it may no longer be supported. The error is (presumably) with node-gyp and their github shows someone had a similar issue that is now closed. Reading that, it looks like they solved it by downgrading from node v12 to v10, which would not be a great outcome for you.

1 Like

Though probably not the issue here, don't use sudo to install nodes unless you have a good reason to do that. Go to your .node-red folder and install not using sudo.
You may now have a problem with file permissions as you may have installed fles to your home folder with root permission, so if you start getting permissions errors that that is the cause.

Thanks very much for the reply, ran the command from the .node-red dir without sudo and the below is the tail of the error trail. Interesting, I have rebuilt the OS and carefully ran the suggested scripts from the node home page, it still appears to be unhappy

/home/pi/.cache/node-gyp/12.18.2/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:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.19.118-v7l+
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.18.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! i2c-bus@1.2.5 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c-bus@1.2.5 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-07-13T07_43_48_534Z-debug.log
pi@raspberrypi:~/.node-red $

Noted thanks, i did see that, I think my problem is a deeper than that I get the same errors irrespective of the node I try to install.. rgds

Just to keep us happy can you repeat that with a different node not related to I2C? Something like node-red-contrib-simple-gate for example?

Thanks for the message, below is the output,,

pi@raspberrypi:~/.node-red $ npm install node-red-contrib-simple-gate
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

  • node-red-contrib-simple-gate@0.3.1
    updated 1 package and audited 86 packages in 2.036s

1 package is looking for funding
run npm fund for details

found 0 vulnerabilities

OK, I thought you said the message was independent of the node you try to install. Show us the full output when you try to install the dht node.

Thnx, I did say that, however I wasn't running the command from the .node-red dir, below is the output clearly added the node ok, thnx. Clearly there are some other issues I haven't yet got my head around, will drill into the comms etc..
Thnx for responding

npm install node-red-contrib-dht-sensor
pi@raspberrypi:~/.node-red $ npm install node-red-contrib-dht-sensor
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

  • node-red-contrib-dht-sensor@1.0.4
    removed 689 packages, updated 1 package and audited 86 packages in 11.213s

1 package is looking for funding
run npm fund for details

found 0 vulnerabilities

That seems a bit odd.

Before i dive into the documentation can I ask if this looks correct ? thanks in advance Cheers

pi@raspberrypi:~/.node-red $ npm list -g --depth 0
/usr/lib
├── node-red@1.1.2
└── npm@6.14.6

yes, that is what I have.

OK, Thanks very much

I think this may be your best hope of getting it to install

1 Like

Thanks Colin, tinkering around with it....will let you know the outcome

Thanks Michael, as you mention there is clearly an issue. Digging around in the github I can see the version went backwards and as you say its been a while since the code changed..

Long story short, the OLED section is now on the left and appears to work in a flow and configures as expected

Used the instructions to "get this to work #21" I installed the 3 dependencies no probs, modified the package.json file to reflect the versions.

Ran the install no joy, I noticed in the error that it kept saying there was no associated json file

I pulled the zip from git, created a dir, placed the files in it and modified the dependency versions to reflect what had successfully installed. No joy.

I then noticed that the error kept referring to a hidden dir that was hanging directly off the /home/pi dir, named node-red-contrib-oled so I created a hidden dir there, copied the files into it, modified the package.json file to reflect the version of the dependencies that download successfully and the below was reported

I kept notes as I was going through and am yet to run the code to see if the display works but looks encouraging

pi@raspberrypi:~/.node-red $ npm i ~/.node-red-contrib-oled

i2c-bus@5.2.0 install /home/pi/.node-red-contrib-oled/node_modules/i2c-bus
node-gyp rebuild

make: Entering directory '/home/pi/.node-red-contrib-oled/node_modules/i2c-bus/build'
CXX(target) Release/obj.target/i2c/src/i2c.o
SOLINK_MODULE(target) Release/obj.target/i2c.node
COPY Release/i2c.node
make: Leaving directory '/home/pi/.node-red-contrib-oled/node_modules/i2c-bus/build'
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

  • node-red-contrib-oled@0.2.0
    added 7 packages from 11 contributors, removed 671 packages and audited 170 packages in 20.2s

3 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

Without seeing the exact error I can't comment on that.

OK, thanks,

Basically until i created the hidden dir in /home/pi and copied the modified files and dirs into it and ran the install with the following, the OLED section would not appear in node list

pi@raspberrypi:~/.node-red $ npm i node-red-contrib-oled

Thanks for the responses

The usual way to install a node where you have the sources on your own disc is to use
npm i /path/to/node-red-contrib-whatever
which should have done what was necessary.