System update broke node red

Hi all,

I'm just getting started with node red and it looks like I've already broken it....

I had to do a system upgrade in order to get the latest nodejs. Now, when I type:

node-red

Nothing happens. I just get a shell prompt back.

Note:

mdiehl@hydra:~/.node-red$ which node-red
/usr/local/bin/node-red

mdiehl@hydra:~/.node-red$ ls -la /usr/local/bin/node-red
lrwxrwxrwx 1 root root 35 Jan 30 15:11 /usr/local/bin/node-red -> ../lib/node_modules/node-red/red.js

Looks like this symlink is broken, but I can fix that.

However, when I run:

nodejs /usr/local/lib/node_modules/node-red/red.js

I get:

/usr/local/lib/node_modules/node-red/node_modules/fs-extra/lib/index.js:3
const assign = require('./util/assign')
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/local/lib/node_modules/node-red/red.js:26:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

And finally:

mdiehl@hydra:~/.node-red$ nodejs -v
v0.10.25

So, any pointers on how to unbreak this would be much appreciated.

Mike.

When you say you 'had to do a system upgrade in order to get the latest nodejs' what exactly did you do?

Node 0.10 is very old and unsupported.

What flavour of linux is this? The default package managers for debian and ubuntu etc have very out of data node.js packages in them. There are alternative community-maintained node packages that are completely up to date and recommended.

If this is a debian/ubuntu system, then the update script we provide for the Raspberry Pi will also work - this updates node/npm to the latest as well as Node-RED. Redirectingā€¦

Hi!

Thank you for such a quick reply!

In order to update node-red, I ran:

npm install node-red

That seems to have been my method of destruction...

So, per your instructions, I followed the steps for node red installation on the pi.

That didn't end well, but gave me some insight:

Running Node-RED update for user mdiehl at /home/mdiehl
[sudo] password for mdiehl:

This can take 20-30 minutes on the slower Pi versions - please wait.

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Using N to manage Node.js +
Update Node.js LTS āœ˜ Failed to install Node.js - Exit
Clean npm cache
Install Node-RED core
Move global nodes to local
Install extra Pi nodes
Npm rebuild existing nodes
Add shortcut commands
Update systemd script

Any errors will be logged to /var/log/nodered-install.log

The logged errors are mostly the same things.

So, Kubuntu's node.js is too old? This is an old machine....

So, at https://nodejs.org/en/, I see that I have two options for manual installation:

10.15.1 or 11.9

Do you have recommendations as to which way I need to go?

Also, am I missing anything? Or should this fix it?

Thanks again,

Mike

I always run Nodejs 8 (as the Node-Red installation page says it's what they recommend)
Here -> https://nodered.org/docs/getting-started/installation

So I run:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Then I install Node-Red:

sudo npm install -g --unsafe-perm node-red

You people freaking ROCK!

It's back up and running again!

Thank you.

1 Like