Node-red-contrib-chart-image, trouble getting installed

I tried installing the package node-red-contrib-chart-image from the pallet manager, but this failed.
So I looked around for solutions. I found,

Thank you for the advice, I managed to get it working.
I had to do 3 steps:

  1. Had to install some dependencies as described on canvas - npm
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
  1. Next I could install canvas (using the pi user, starting /home/pi folder):
npm install canvas
  1. After the above 2 steps chart-image has installed from the Palette Manager in Node-Red.

Your example is working now.

Let me ask a related question: if I want to create a small graphics for example show a measurement value, maybe influence the colour based on the value, add trending icon or something similar and send that over telegram as an image. Since I have canvas installed, I could just create a canvas object and save the result to an image similarly like it is done for the canvas image, right?

I tried the above solution, and I had a lot less errors, but still have some as you can see in the log,

> 
> 
> 2022-12-02T15:35:35.205Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-chart-image@1.2.0
> 
> 2022-12-02T15:35:37.701Z [err] npm
> 
> 2022-12-02T15:35:37.703Z [err]
> 
> 2022-12-02T15:35:37.703Z [err] WARN config production Use `--omit=dev` instead.
> 
> 2022-12-02T15:35:45.077Z [err] npm ERR! code EACCES
> 
> 2022-12-02T15:35:45.077Z [err] npm ERR! syscall rename
> 
> 2022-12-02T15:35:45.077Z [err] npm ERR! path /home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/semver
> 
> 2022-12-02T15:35:45.077Z [err] npm ERR! dest /home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/.semver-S9LLPkuk
> 
> 2022-12-02T15:35:45.078Z [err] npm ERR!
> 
> 2022-12-02T15:35:45.079Z [err] errno -13
> 
> 2022-12-02T15:35:45.087Z [err] npm ERR! Error: EACCES: permission denied, rename '/home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/semver' -> '/home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/.semver-S9LLPkuk'
> 
> 2022-12-02T15:35:45.087Z [err] npm ERR! [Error: EACCES: permission denied, rename '/home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/semver' -> '/home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/.semver-S9LLPkuk'] {
> 
> 2022-12-02T15:35:45.087Z [err] npm ERR! errno: -13,
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! code: 'EACCES',
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! syscall: 'rename',
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! path: '/home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/semver',
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! dest: '/home/pi/.node-red/node_modules/node-gyp/node_modules/.bin/.semver-S9LLPkuk'
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! }
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR!
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! The operation was rejected by your operating system.
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! It is likely you do not have the permissions to access this file as the current user
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR!
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! If you believe this might be a permissions issue, please double-check the
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! permissions of the file and its containing directories, or try running
> 
> 2022-12-02T15:35:45.099Z [err] npm ERR! the command again as root/Administrator.
> 
> 2022-12-02T15:35:45.107Z [err]
> 
> 2022-12-02T15:35:45.107Z [err] npm ERR! A complete log of this run can be found in:
> 
> 2022-12-02T15:35:45.107Z [err] npm ERR! /home/pi/.npm/_logs/2022-12-02T15_35_37_574Z-debug-0.log
> 
> 2022-12-02T15:35:45.132Z rc=243

Can anyone give me advice on this problem?

Remove the whole of the directory /home/pi/.node-red/node_modules/node-gyp/node_modules/.bin and try again.

I removed this dir, but still have trouble installing:

> 2022-12-02T16:31:25.695Z Install : node-red-contrib-chart-image 1.2.0
> 
> 2022-12-02T16:31:25.946Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-chart-image@1.2.0
> 
> 2022-12-02T16:31:28.642Z [err] npm WARN config production Use `--omit=dev` instead.
> 
> 2022-12-02T16:31:36.789Z [err] npm
> 
> 2022-12-02T16:31:36.789Z [err] ERR! code EACCES
> 
> 2022-12-02T16:31:36.790Z [err] npm ERR!
> 
> 2022-12-02T16:31:36.790Z [err] syscall rename
> 
> 2022-12-02T16:31:36.790Z [err] npm
> 
> 2022-12-02T16:31:36.790Z [err] ERR! path
> 
> 2022-12-02T16:31:36.790Z [err] /home/pi/.node-red/node_modules/@npmcli/fs/node_modules/semver
> 
> 2022-12-02T16:31:36.791Z [err] npm
> 
> 2022-12-02T16:31:36.791Z [err] ERR! dest /home/pi/.node-red/node_modules/@npmcli/fs/node_modules/.semver-bpWbmNFZ
> 
> 2022-12-02T16:31:36.792Z [err] npm ERR!
> 
> 2022-12-02T16:31:36.792Z [err] errno -13
> 
> 2022-12-02T16:31:36.800Z [err] npm ERR!
> 
> 2022-12-02T16:31:36.801Z [err] Error: EACCES: permission denied, rename '/home/pi/.node-red/node_modules/@npmcli/fs/node_modules/semver' -> '/home/pi/.node-red/node_modules/@npmcli/fs/node_modules/.semver-bpWbmNFZ'
> 
> 2022-12-02T16:31:36.801Z [err] npm ERR! [Error: EACCES: permission denied, rename '/home/pi/.node-red/node_modules/@npmcli/fs/node_modules/semver' -> '/home/pi/.node-red/node_modules/@npmcli/fs/node_modules/.semver-bpWbmNFZ'] {
> 
> 2022-12-02T16:31:36.801Z [err] npm ERR! errno: -13,
> 
> 2022-12-02T16:31:36.801Z [err] npm
> 
> 2022-12-02T16:31:36.801Z [err] ERR! code: 'EACCES',
> 
> 2022-12-02T16:31:36.801Z [err] npm ERR!
> 
> 2022-12-02T16:31:36.802Z [err] syscall: 'rename',
> 
> 2022-12-02T16:31:36.802Z [err] npm ERR! path: '/home/pi/.node-red/node_modules/@npmcli/fs/node_modules/semver',
> 
> 2022-12-02T16:31:36.802Z [err] npm ERR! dest: '/home/pi/.node-red/node_modules/@npmcli/fs/node_modules/.semver-bpWbmNFZ'
> 
> 2022-12-02T16:31:36.802Z [err] npm
> 
> 2022-12-02T16:31:36.802Z [err] ERR! }
> 
> 2022-12-02T16:31:36.802Z [err] npm ERR!
> 
> 2022-12-02T16:31:36.802Z [err]
> 
> 2022-12-02T16:31:36.802Z [err] npm ERR! The operation was rejected by your operating system.
> 
> 2022-12-02T16:31:36.802Z [err] npm
> 
> 2022-12-02T16:31:36.803Z [err] ERR! It is likely you do not have the permissions to access this file as the current user
> 
> 2022-12-02T16:31:36.803Z [err] npm
> 
> 2022-12-02T16:31:36.803Z [err] ERR!
> 
> 2022-12-02T16:31:36.803Z [err] npm
> 
> 2022-12-02T16:31:36.803Z [err] ERR! If you believe this might be a permissions issue, please double-check the
> 
> 2022-12-02T16:31:36.803Z [err] npm
> 
> 2022-12-02T16:31:36.803Z [err] ERR! permissions of the file and its containing directories, or try running
> 
> 2022-12-02T16:31:36.803Z [err] npm ERR! the command again as root/Administrator.
> 
> 2022-12-02T16:31:36.810Z [err]
> 
> 2022-12-02T16:31:36.811Z [err] npm
> 
> 2022-12-02T16:31:36.811Z [err] ERR! A complete log of this run can be found in:
> 
> 2022-12-02T16:31:36.811Z [err] npm ERR! /home/pi/.npm/_logs/2022-12-02T16_31_28_496Z-debug-0.log
> 
> 2022-12-02T16:31:36.833Z rc=243

I tried installing from terminal, no errors

sudo npm install node-red-contrib-chart-image

but it doesn't appear in pallet manager

Never use sudo unless you know that it is what you should do. You may now have created some files in your home folder with root permissions, which will cause different problems. We will have to sort those problems out if they appear.

npm seems to get itself in a mess sometimes, it is not clear why.
Rename the directory /home/pi/.node-red/node_modules to something else (just in case we want to look at it again. Then go into the .node-red folder and run
npm install
which should rebuild it. It might take a little while depending on what sort of pi it is.

What do these commands show
npm -v
node -v

@dceejay @knolleary this problem seems to be occurring more and more often. Do we have any clues about what the underlying cause is?

Sadly no...

I did without sudo.

@Colin

I got some warnings

npm 9.1.3
node -v v16.18.1

Everything seems to be working fine. npm audit no issues

@colin Should I try installing node-red-contrib-chart-image again?

Yes, try again.

@Colin

Install took a very long time, but it looks ok now. Thanks very much, Colin.

That is a bit odd. Do you remember how you installed nodejs and npm? The default install of nodejs includes npm, and I have npm 8.19.2 with nodejs 16.18.1

How did you install node-red?

What model of pi is it?

@colin I have a bash file for that

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

I have a software overview where I can see what version is installed and what version is latest.

afbeelding

So I saw one time that everything was uptodate, except for npm. So I asked at this forum how to upgrade npm, this was the answer:

sudo npm install -g npm@latest

Pi model is 3B+

That is interesting, I wonder if you have ended up with an npm that is not compatible with the nodejs you have. It may be nothing to do with that though.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.