Help Wanted - testing updated install script

Is the script supposed to time out after about 30 seconds on the pi specific nodes question (just when you are trying to remember what they are and check whether you want them)? It appears to default to no.

A corollary question is, if this is a run of the script over an existing install should it even ask the question?

Correct. If you say yes it will install latest versions of pi nodes. If you say no it will leave whatever is there. So generally would be ok to leave it default to no unless a new install.

We don’t know if you have installed them before.

Do you mean it is supposed to timeout after 30 seconds and drop through?

Yes - Still correct

OK, has it always done that?

Yes it has

OK, thanks. I should have tried it myself to find out, sorry.

I was pretty certain it was the right file - i transferred it to my PC using WINSCP and then attached.

Let em grab it again to confirm i did not throw you a red herring

Craig

Ran the latest test again - here is the result

pi@HA-NodeJS-Dev:~/.node-red$

This script checks the version of node.js installed is 12 or greater. It will try to
install node 14 if none is found. It can optionally install node 12 LTS or 14 LTS for you.

If necessary it will then remove the old core of Node-RED, before then installing the latest
version. You can also optionally specify the version required.

It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.

To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.

See the optional parameters by re-running this command with --help

Are you really sure you want to do this ? [y/N] ? y

Would you like to install the Pi-specific nodes ? [y/N] ? n

Running Node-RED update for user pi at /home/pi on ubuntu

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:
Node option not specified : --node12 or --node14
Leave existing Node.js : v14.17.0 Npm 6.14.13
Clean npm cache -
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it! existing nodes
Install Node-RED core :heavy_check_mark:
Move global nodes to local -
Leave existing nodes -
Install extra Pi nodes -
Add shortcut commands :heavy_check_mark:
Update systemd script :heavy_check_mark:/nodered-install.log

All done.
You can now start Node-RED with the command node-red-start
or using the icon under Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started Sun 23 May 12:14:21 AEST 2021 - Finished Sun 23 May 12:14:47 AEST 2021

pi@HA-NodeJS-Dev:~/.node-red$ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://172.16.100.36:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
Error loading settings file: /home/pi/.node-red/settings.js
Error: Could not locate the bindings file. Tried:
→ /home/pi/.node-red/node_modules/node-expat/build/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/build/Debug/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/build/Release/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/out/Debug/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/Debug/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/out/Release/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/Release/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/build/default/node_expat.node
→ /home/pi/.node-red/node_modules/node-expat/compiled/14.17.0/linux/x64/node_expat.node
at bindings (/home/pi/.node-red/node_modules/bindings/bindings.js:93:9)
at Object. (/home/pi/.node-red/node_modules/node-expat/lib/node-expat.js:4:32)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/home/pi/.node-red/node_modules/xml2json/lib/xml2json.js:1:13)
at Module._compile (internal/modules/cjs/loader.js:1068:30) {
tries: [
'/home/pi/.node-red/node_modules/node-expat/build/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/build/Debug/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/build/Release/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/out/Debug/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/Debug/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/out/Release/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/Release/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/build/default/node_expat.node',
'/home/pi/.node-red/node_modules/node-expat/compiled/14.17.0/linux/x64/node_expat.node'
]
}

Craig

Hi Dave, FYI, Linux under Windows WSL worked a treat

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

Windows10 → WSL → Ubuntu 20.04.1 LTS

It uninstalled node v14 & installed v16 & updated node-red without a hitch.

Absolutely perfect :+1:

1 Like

Hi Dave, FYI

Just tried the default install on an alpine image under WSL

I know this script is for PI / Ubuntu, but it is very nearly possible to use on other distros.

If this is of interest...

this is the result of running the script on a fresh alpine installation...

 Install Node.js 14 LTS              ✘   Bad install Node.js  or Npm missing - Exit

logifle...

## Installing the NodeSource Node.js 14.x repo...


## Populating apt-get cache...

+ apt-get update
bash: line 1: apt-get: command not found
Error executing command, exiting
sudo: apt: command not found

Obviously, the issue is apt is not present. Alpine uses apk instead of apt.

But after manually installing nodejs and npm, the script ran & installed a working node-red (minus the systemd service)...

I have modified a local copy of the script that does the following...

  • if (node or npm) AND apt is missing
    • exit the script indicating to the user they will need to "manually install node-js + npm"
  • if systemd is missing
    • skip shortcut setup
    • skip service setup

@Steve-Mcl - A PR would be great !

Dave,

Ok i manually edited the package file and removed the XML2JSON package

I then commented it out in the settings.js

I also used NPM to uninstall node-expat

And the script now runs through fine

Craig

Hi Dave,

No bother...

PR raised: V2 - allow script to continue even if apt or systemd is missing by Steve-Mcl · Pull Request #14 · node-red/linux-installers · GitHub

Just for fun, I installed Debian to run under WSL on my Win10 setup

For some reason, curl wasn't installed by default but after installing that the install seemed to go fine

image

but when I cd..d into .node-red there was no settings.js file - I ran node-red anyway and it worked (and warned me that port was in use - which it was )

I exited and settings.js now existed so I just edited it to change to port 11880 and all works fine :slight_smile:

Files in ~/.node-red are not created until first run Simon.

Glad it worked anyhow - phew :slight_smile:

PS: I didn't state (for brevity) on my previous posts about curl being missing when installing node-red on the alpine image under WSL - I also had to install curl. In fact, I also had to install sudo and setup sudo groups etc - but I thought it was out of scope so didn't mention it.

Aah - I see you like your little secrets :slight_smile:

I hadn't realised that as I'd normally install NR onto a new Pi and just run it.

When I add extra instances on a machine with NR on it - I use @TotallyInformation alternate installer and that does create the settings.js file so I can edit port number before 1st launch

Is there a reason that main installer doesn't create the settings.js file before 1st run?

1 Like

You'll have to ask Nick or Dave but I suspect it is because you may not want to have your flows in ~/.node-red (I don't) so the files would be created for no reason.

Just keepin' it brief :stuck_out_tongue:

Well you wasted 2 days of my time as it didn't work so I removed my existing WSL setup and re-installed it :slight_smile:

Your off my Christmas card list! :slight_smile:

haha - sowwy Simon.

In my defence, I figured since you need curl to actually download the remote script in the first place and the terminal tells you its not found, it would be obvious :stuck_out_tongue:

Its not my fault you got the sledgehammer out to crack the nut :rofl: :rofl:

Put me back on the good list immediately :innocent: