# Issues trying to install on new Pi 4

**URL:** <https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485>\
**Category:** General\
**Created:** [23 February 2021 13:34 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485 "2021-02-23T13:34:49Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 13:34 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/1 "2021-02-23T13:34:49Z")

</div>

![Try to start after install](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/b/6b77da3796f16e42f2ab6bf5f6749fc0b7da5dd8.jpeg) ![At end of install](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/5122d12f03c441008b76d40758067248734df4c7.jpeg)

It says successfully loaded, but I cannot start either from window or Programming-Node-Red at VNC...  
What am I doing wrong?

---

<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:** [23 February 2021 13:55 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/2 "2021-02-23T13:55:30Z")

</div>

Did you manually install nodejs version 15.9? That is not a supported version, though it does not mean that that is the problem. To rule it out, however, I would start by removing nodejs and then re-running the script, which will install a supported version. You should be able to remove nodejs by doing  
`apt remove nodejs`  
If it still doesn't work then post install log here (it tells you where it is at the end of the script). The log may have multiple runs of the script there so just post the last one.

See this post for details of the best way of posting logs and flows - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 15:42 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/3 "2021-02-23T15:42:49Z")

</div>

Upon trying:

```auto
pi@raspberrypi:~ $ apt remove nodejs
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 February 2021 15:44 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/4 "2021-02-23T15:44:36Z")

</div>

> [@Industrialogics](#):
>
> `are you root?`

`sudo apt remove nodejs`

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 15:51 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/5 "2021-02-23T15:51:03Z")

</div>

From var/node-red log

```auto
Started : Tue 23 Feb 2021 09:44:08 AM CST
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.
Already have nodejs v15.9.0
Now install nodejs
Versions: node:v15.9.0 npm:7.5.4
Now install Node-RED
sudo: npm: command not found
Now create basic package.json for the user and move any global nodes
Installing extra nodes: node-red-node-pi-gpio@latest node-red-node-random@latest node-red-node-ping@latest node-red-contrib-play-audio@latest node-red-node-smooth@latest node-red-node-serialport@latest :

up to date in 12s
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for pi
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
The user `pi' is already a member of `gpio'.
Memory : 7.8G
Finished : Tue 23 Feb 2021 09:44:08 AM CST

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 February 2021 15:53 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/6 "2021-02-23T15:53:55Z")

</div>

> [@Industrialogics](#):
>
> `Already have nodejs v15.9.0`

Seems you didnt remove nodejs v15 before re-running node-red install script?

---

<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:** [23 February 2021 16:13 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/7 "2021-02-23T16:13:45Z")

</div>

> [@Industrialogics](#):
>
> `sudo: npm: command not found`

That is actually the original cause of the problem. Somehow you have an unsupported version of nodejs but don't have npm installed at all.  
Remove nodejs as I suggested (but using sudo, I just assumed you would know that, which I should not have done) then rerun the script.

---

<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:** [23 February 2021 16:17 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/8 "2021-02-23T16:17:47Z")

</div>

@dceejay, this seems to be a bit of a hole in the install script. If nodejs is already installed, but npm is not then it does not take appropriate action.

**[Edit]** Actually something very odd is going on, as it has

> [@Industrialogics](#):
>
> ```auto
> Already have nodejs v15.9.0
> Now install nodejs
> Versions: node:v15.9.0 npm:7.5.4
> Now install Node-RED
> sudo: npm: command not found
> 
> ```

which suggests node and npm must be installed locally, or something similar. Exploring this in later posts.

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 16:37 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/9 "2021-02-23T16:37:39Z")

</div>

> [@Colin](#):
>
> apt remove nodejs

```auto
pi@raspberrypi:~ $ sudo apt remove nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ 

```

---

<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:** [23 February 2021 16:48 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/11 "2021-02-23T16:48:54Z")

</div>

What do these commands show  
`node -v`  
and  
`which node`

How did you get to this situation? You said it is a new pi 4, but somehow you have a messed up or unusual system.

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 16:52 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/12 "2021-02-23T16:52:15Z")

</div>

```auto
pi@raspberrypi:~ $ node -v
v15.9.0
pi@raspberrypi:~ $ which node
/home/pi/.config/nvm/versions/node/v15.9.0/bin/node
pi@raspberrypi:~ $ 

```

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 16:54 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/13 "2021-02-23T16:54:28Z")

</div>

```auto
Started : Tue 23 Feb 2021 10:41:09 AM CST
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.
Already have nodejs v15.9.0
Now install nodejs
Versions: node:v15.9.0 npm:7.5.4
Now install Node-RED
sudo: npm: command not found
Now create basic package.json for the user and move any global nodes
Installing extra nodes: node-red-node-pi-gpio@latest node-red-node-random@latest node-red-node-ping@latest node-red-contrib-play-audio@latest node-red-node-smooth@latest node-red-node-serialport@latest :

up to date in 2s
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for pi
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
The user `pi' is already a member of `gpio'.
Memory : 7.8G
Finished : Tue 23 Feb 2021 10:41:09 AM CST

```

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 16:57 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/14 "2021-02-23T16:57:24Z")

</div>

Using this setup,

> **[Installing Node-RED, an amateur's guide - The Mays](https://themays.me/installing-node-red-an-amateurs-guide/#rpisetup)**
>
> An amateur's guide to installing Node-RED from GitHub on the Raspberry Pi. This installs latest releases of nodejs, nvm, Node-RED, and PM2.

---

<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:** [23 February 2021 17:00 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/15 "2021-02-23T17:00:28Z")

</div>

That is the problem, you are using nvm. Don't do that. Uninstall nvm and delete the folder `.nvm` then run the script again.

I thought the script checked for nvm and produced a warning, but it doesn't seem to be there.

**[Edit]** Also delete .config/nvm

---

<div class="post-metadata">

**Author:** ![Industrialogics](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Industrialogics](https://discourse.nodered.org/u/Industrialogics)\
**Post date:** [23 February 2021 18:46 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/17 "2021-02-23T18:46:39Z")

</div>

You guys rock...  
Deleted nvm, re-run script and life is good again...  
This time when it loaded Node-Red, it took about 20 minutes, but showed a version 12.21, I believe...  
To all who input, thank you...

---

<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:** [26 February 2021 21:09 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/18 "2021-02-26T21:09:58Z")

</div>

Just to finish this off, I have been in communication with the author of the blog you followed and helped him work through some issues he had with the install script. He is in the process of updating the blog to reference the recommended script.

---

<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:** [12 March 2021 21:10 UTC](https://discourse.nodered.org/t/issues-trying-to-install-on-new-pi-4/41485/19 "2021-03-12T21:10:08Z")

</div>

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