node-red / linux-installers

Node-RED install scripts for various flavours of Linux
Apache License 2.0
94 stars 63 forks source link

Installer bash script fails to install node-red V3.0.0 #31

Closed juggledad closed 2 years ago

juggledad commented 2 years ago

when running the bash script on a Pi, the install fails (https://discourse.nodered.org/t/node-red-v3-0-0-pi-installer-script-node-red-does-not-start-after-installer-is-finished-setting-js-no-such-file-or-directory/65085/4)

However if you use sudo npm install -g --unsafe-perm node-red it does install

This is the nstall log using the bash script: pi@testpi:~ $ cat /var/log/nodered-install.log Already have nodejs v14.20.0 OLD nodejs 14 : NEW nodejs :


Started : Thu 14 Jul 2022 06:59:41 AM EDT Running for user pi at /home/pi Found global nodes: :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists... Building dependency tree... Reading state information... Package 'nodered' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Versions: node:v14.20.0 npm:6.14.17 Now install Node-RED npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN node-red-contrib-mp4frag@0.1.0-beta.4 requires a peer of socket.io@2 || 3 || 4 but none is installed. You must install peer dependencies yourself. npm WARN node-red-contrib-ui-mp4frag@0.1.0-beta.3 requires a peer of node-red-dashboard@^2.26.1 but none is installed. You must install peer dependencies yourself. npm WARN pi No description npm WARN pi No repository field. npm WARN pi No README data npm WARN pi No license field.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists... Building dependency tree... Reading state information... python3-rpi.gpio is already the newest version (0.7.0-0.1~bpo10+4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Memory : 971M Started : Thu 14 Jul 2022 06:59:41 AM EDT Finished: Thu 14 Jul 2022 07:01:00 AM EDT pi@testpi:~ $

Steve-Mcl commented 2 years ago

OK, I think I know what the issue is (but not certain on the "right" solution)

In simple terms, i believe this will work if you first update NPM

That is due to usage of --location=global (here) which will not work on NPM v7 or older.

I know --global was depreciated in a single version of NPM v8.x? but was swiftly reverted in an immediate follow up version.


Potential solutions

  1. stop install if NPM < 8
  2. revert to using -g
  3. add both flags? -g --location=global ? (never tried)

@dceejay - any opinion on this please?

dceejay commented 2 years ago

happy to go back to -g... one sec pushed

Steve-Mcl commented 2 years ago

I think i know why you did this - the spurious warnings about depreciation right? I wonder if there is a recommended way to handle the transition other than one or the other!?!?

dceejay commented 2 years ago

yes exactly - messes up the "ui" - but I guess if they have reverted it - it should clean up after a while when newer npm gets baked in.

juggledad commented 2 years ago

just ran the script and it worked.

Steve-Mcl commented 2 years ago

Dave. I am speaking from memory (can't find the thread I read to confirm accuracy) - I just knew it was related to the -g : flag and the depreciation notice somehow

I'm fairly certain npm will eventually switch over to the new style, but I seem to remember reading they had removed the warning from stdout - for now!

We'll see how this goes over the next few weeks.