# Install script node\<version\> fails

**URL:** <https://discourse.nodered.org/t/install-script-node-version-fails/70431>\
**Category:** General\
**Created:** [11 November 2022 09:55 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431 "2022-11-11T09:55:15Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [11 November 2022 09:55 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/1 "2022-11-11T09:55:15Z")

</div>

I had installed a new server with nodejs, happened to be node 19.x, so I figured if I install NR with the --node16 option, it would uninstall v19 and install v16, but the install script states:

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

  Stop Node-RED ✔
  Remove old version of Node-RED ✔
  Remove old version of Node.js ✔ v19.0.1
  Install Node.js 16 LTS ✔ v19.0.1 Npm 8.19.2
  Clean npm cache ✔
  Install Node-RED core ✔ 3.0.2
  Move global nodes to local -
  Npm rebuild existing nodes ✔
  Install extra Pi nodes -
  Add shortcut commands ✔
  Update systemd script ✔

```

Is this correct ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 November 2022 10:10 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/2 "2022-11-11T10:10:38Z")

</div>

No, it has failed to remove nodejs 19 and replace it with 16. How did you install v19 originally?

Also post the install log please. /var/log/nodered-install.log. Or look at it to see what it says about nodejs.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 November 2022 10:13 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/3 "2022-11-11T10:13:02Z")

</div>

Actually, first check that this works without error  
`sudo apt update`  
`sudo apt full-upgrade`  
If it does anything then try the script again. If it still fails then what does  
`apt policy nodejs`  
say?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [11 November 2022 10:37 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/4 "2022-11-11T10:37:50Z")

</div>

The install log:

```auto
Started : Fri 11 Nov 2022 10:47:04 AM CET
Running for user administrator at /home/administrator
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...
E: Unable to locate package nodered
Installing nodejs 16

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

Reading package lists...
Building dependency tree...
Reading state information...
Package 'npm' is not installed, so not removed
The following packages will be REMOVED:
  nodejs
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 183 MB disk space will be freed.
(Reading database ...

Removing nodejs (19.0.1-deb-1nodesource1) ...
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules' not empty so not removed
Processing triggers for man-db (2.9.4-2) ...
dpkg: warning: ignoring request to remove nodejs which isn't installed
dpkg: warning: ignoring request to remove node which isn't installed

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

Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Grab the LTS bundle

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

Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.74.0-1.3+deb11u3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

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

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/29.0 MB of archives.
After this operation, 183 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ...

Preparing to unpack .../nodejs_19.0.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (19.0.1-deb-1nodesource1) ...
Setting up nodejs (19.0.1-deb-1nodesource1) ...
Processing triggers for man-db (2.9.4-2) ...

Versions: node:v19.0.1 npm:8.19.2
npm WARN using --force Recommended protections disabled.
Now install Node-RED

added 292 packages in 22s
3.0.2
Now create basic package.json for the user and move any global nodes
Running npm rebuild
rebuilt dependencies successfully
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for administrator:administrator @ /home/administrator
ln: failed to create symbolic link '/usr/bin/python': File exists
Now add launcher to top bar, add cpu temp example, make sure ping works
Allow binding to low ports : n
Memory : 8.6G
Started : Fri 11 Nov 2022 10:47:04 AM CET
Finished: Fri 11 Nov 2022 10:47:43 AM CET
Already have nodejs v19.0.1
OLD nodejs 19 :
NEW nodejs 16 :

```

I manually removed nodejs and reinstalled 16 instead.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 November 2022 11:19 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/5 "2022-11-11T11:19:14Z")

</div>

> [@bakman2](#):
>
> I manually removed nodejs

How did you do that?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 November 2022 11:23 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/6 "2022-11-11T11:23:23Z")

</div>

@dceejay can you make any sense of the log above? It appears to say that it going to remove nodejs 19, but then says it isn't installed, and then goes on to install it again.

@bakman2 what OS/version are you using?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [11 November 2022 21:07 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/7 "2022-11-11T21:07:40Z")

</div>

Odd indeed - I'll try to give node19 a whirl tomorrow. (Of course we don't support non-LTS versions but it should be able to remove it :-)...  
Of course you could try to `sudo apt purge nodejs` outside of the script - then use `which node` to check it has gone - then remove any `/etc/apt/sources.list.d/nodesource.list` file - then re-run the script...

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 06:08 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/8 "2022-11-12T06:08:43Z")

</div>

@Colin

> How did you do that?

I did the removal after this initial post, using some guide i found online.

> what OS/version are you using?

Debian 11

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 November 2022 17:06 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/9 "2022-11-12T17:06:27Z")

</div>

Hmm - so - I installed node19.0.1 from [nodejs.org](http://nodejs.org) on my Pi3... then ran the script with ` --node16` added. and no surprises here...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8a9609901f05c6d93c49eff856577cedc0243d2.png)

```auto
pi@pi3:~ $ node -v
v16.18.1

```

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 18:03 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/10 "2022-11-12T18:03:06Z")

</div>

For good measure, don't know if it makes a difference:

I had a clean debian 11 install.  
Installed nodejs (turned out to be v19)  
Installed NR with the script (no options)  
Some flows/nodes failed to work.

Re-ran the script with the --node16 option

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 November 2022 18:03 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/11 "2022-11-12T18:03:41Z")

</div>

On what hardware. Which exact Debian installer ?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 18:07 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/12 "2022-11-12T18:07:17Z")

</div>

In a VM - default debian netinstall iso

```auto
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

$ uname -a
Linux core 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 November 2022 18:08 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/13 "2022-11-12T18:08:12Z")

</div>

VM. . On what architecture ?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 18:10 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/14 "2022-11-12T18:10:53Z")

</div>

Not sure what you mean with architecture, but this is running on Proxmox with KVM/QEMU - x86.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 November 2022 18:11 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/15 "2022-11-12T18:11:43Z")

</div>

X86 ? Or i64 ?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 18:13 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/16 "2022-11-12T18:13:29Z")

</div>

The debian version is amd64 (?)

I can try to replicate it, maybe something with nodejs got borked somewhere in the process.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 November 2022 18:35 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/17 "2022-11-12T18:35:48Z")

</div>

Depends if nodejs 19 came from the default repo (which I don’t think it does in Debian, as they lag terribly so would be 12 most likely).

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 November 2022 20:27 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/18 "2022-11-12T20:27:52Z")

</div>

> [@bakman2](#):
>
> I had a clean debian 11 install.  
> Installed nodejs (turned out to be v19)

How did you install nodejs?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 January 2023 20:27 UTC](https://discourse.nodered.org/t/install-script-node-version-fails/70431/19 "2023-01-11T20:27:52Z")

</div>

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