Npm install not working for only this node

i'm try install cast for node red using this comand:
npm install node-red-contrib-cast

but i have this error:

npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code sh                                                                                                                                                 ould use the URLSearchParams API instead.
npm ERR! code 1
npm ERR! path /root/.node-red/node_modules/protobufjs
npm ERR! command failed
npm ERR! command sh -c -- node scripts/postinstall
npm ERR! node:internal/modules/cjs/loader:998
npm ERR!   throw err;
npm ERR!   ^
npm ERR!
npm ERR! Error: Cannot find module '/root/.node-red/node_modules/protobufjs/scripts/postinst                                                                                                                                                 all'
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:841:27)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:                                                                                                                                                 81:12)
npm ERR!     at node:internal/main/run_main_module:22:47 {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: []
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-02-27T18_23_24_188Z-debug-0.log```



only for this node!!

Try with npm install --unsafe-perm, according to the following issue#877.

1 Like

same error :frowning:

I suspect this is related to your other thread, to do with how you installed and are running node-red.

1 Like

i'm formatting sd card and flash raspbian, i'm follow instruction for install node red but i can't install this node using this command:
npm install node-red-contrib-cast

what if you try to install the package that is failing yourself ?
from .node-red folder npm install protobufjs
if successful then re-run the installation of npm install node-red-contrib-cast

1 Like

Hi!
i'm try but receive same error :frowning:

Exactly which instructions?

How are you starting node red?

The recommended instructions should not give you node red running as free root.

2 Likes

i'm using

node-red-pi --max-old-space-size=256

Please try and answer all the questions, you still have not told us exactly how you installed node red.

Which user are you logged in as when you run that?
Do you use sudo to run it?

1 Like

oh sorry, i'm run this command with user root without sudo

Sorry, but:

From this site:
https://nodered.org/docs/getting-started/raspberrypi

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

I would suggest removing what you have and starting again.

1 Like
  1. Why are you running with user root???
  2. Why in the next screen shot it shows you running sudo npm install node-red-contrib-cast'? you just said you don't use sudo`
  3. When you refreshed the SD card, what user did you setup? If it was 'pi' then (unless you have extenuating reasons you haven't explained) you should run the bash script while signed in as the 'pi' user or the name of the user you chose.

Please open a terminal window and start node-red and copy the log from when you issue the node-red command to when you see the line:

1 Mar 03:34:44 - [info] Started flows

that. along with the answers to all the questions, will give us information to help you out.

1 Like

thanks for all, i fix the problem update npm.
Before check version with command

npm -v

and then update using

npm install -g npm@latest

(previous version 8.19.4)
(current version 9.5.1)

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