# Unable to start Node-red upon boot

**URL:** <https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353>\
**Category:** General\
**Created:** [31 October 2019 05:50 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353 "2019-10-31T05:50:08Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [31 October 2019 20:46 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/23 "2019-10-31T20:46:11Z")

</div>

> [@iDeeW](#):
>
> Below is the log `/var/log/nodered-install.log`

I don't think that is the whole log.

By the way, see this for installing plexmediaserver, you have an out of date repository specified. Go down a bit to where it shows how to enable the official repository.

> **[How to Install Plex Media Server on Ubuntu 18.04 LTS Server or Desktop](https://www.linuxbabe.com/ubuntu/install-plex-media-server-ubuntu-18-04)**
>
> This tutorial shows you how to install Plex media server on Ubuntu 18.04 LTS server/desktop. Enable Plex repository and access external hard drive

---

<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:** [1 November 2019 12:30 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/24 "2019-11-01T12:30:08Z")

</div>

I have looked at the install script and can't see how it didn't setup the script correctly, so would be grateful if you could post the full install log when convenient.  
Thanks.

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [1 November 2019 13:52 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/25 "2019-11-01T13:52:00Z")

</div>

Log file....  
[nodered-install.log.txt](https://discourse.nodered.org/uploads/short-url/turdEzhL3z1VJRvJuguSRuaoYdw.txt) (3.6 KB)

My Plex server is up to date. But I will take a look at the link you posted.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5abfc94f2a364f52aa6b9affc5ffedb842a87022.png)

Thank you for your help.

---

<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:** [1 November 2019 14:00 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/26 "2019-11-01T14:00:02Z")

</div>

That cannot be the whole of the log, it has not even got as far as installing nodejs.

---

<div class="post-metadata">

**Author:** ![rasheeda](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@rasheeda](https://discourse.nodered.org/u/rasheeda)\
**Post date:** [4 November 2019 15:42 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/27 "2019-11-04T15:42:27Z")

</div>

Use one of methods to run the task at start up. i tried rc.local. you can execute it manually and verify. initial faced same issues.

---

<div class="post-metadata">

**Author:** ![ajhart](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@ajhart](https://discourse.nodered.org/u/ajhart)\
**Post date:** [28 January 2020 11:43 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/28 "2020-01-28T11:43:03Z")

</div>

sudo nano /lib/systemd/system/nodered.service  
Replace  
`Environment="NODE_OPTIONS=--max_old_space_size=256"`  
with

```auto
Environment="NODE_OPTIONS=--max-old-space-size=256"

```

Worked for me.

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [31 May 2020 23:10 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/29 "2020-05-31T23:10:51Z")

</div>

hmmm I've just tried to upgrade node-red using the original script I used to install and now starting from the service fails, but I can get it to run if I run node-red-start.

I used the script

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

```auto
root@raspbx:~# sudo systemctl status nodered
● nodered.service - Node-RED graphical event wiring tool
   Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2020-05-31 23:59:18 BST; 6min ago
     Docs: http://nodered.org/docs/hardware/raspberrypi.html
 Main PID: 435 (code=exited, status=127)

May 31 23:59:17 raspbx systemd[1]: nodered.service: Failed with result 'exit-code'.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Service hold-off time over, scheduling restart.
May 31 23:59:18 raspbx systemd[1]: Stopped Node-RED graphical event wiring tool.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Start request repeated too quickly.
May 31 23:59:18 raspbx systemd[1]: Failed to start Node-RED graphical event wiring tool.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Unit entered failed state.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Failed with result 'exit-code'.

```

`/usr/bin/env: ‘node-red-pi’: No such file or directory`

Also this " `node-red-start` - this starts the Node-RED service and displays its log output. Pressing `Ctrl-C` or closing the window does _not_ stop the service; it keeps running in the background"

simply isn't true - pressing ctrl-c or closing the Window DOES stop the service on my install. I wish I hadn't tried to upgrade, the script has totally broken a working installation!

---

<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:** [1 June 2020 01:25 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/30 "2020-06-01T01:25:49Z")

</div>

Can you show us the log from when you run the script ? And also a log of when you just run the node-red command

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 06:46 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/31 "2020-06-01T06:46:52Z")

</div>

--------\>[Error log](https://termbin.com/65cw). \<-------

node-red-log:

```auto
Started Node-RED graphical event wiring tool.

Node-RED is not yet fully installed
   Can't reach upgrade server - please check your internet connection.

```

whereas `node-red-start` starts the app within that terminal window, as soon as I close it or `ctrl-c` it stops again.

```auto
Welcome to Node-RED
===================

1 Jun 07:46:13 - [info] Node-RED version: v1.0.6
1 Jun 07:46:13 - [info] Node.js version: v12.15.0
1 Jun 07:46:13 - [info] Linux 4.19.57-v7+ arm LE
1 Jun 07:46:14 - [info] Loading palette nodes
1 Jun 07:46:16 - [warn] ------------------------------------------------------
1 Jun 07:46:16 - [warn] [node-red-node-serialport/serialport] Error: The module '/root/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
1 Jun 07:46:16 - [warn] ------------------------------------------------------
1 Jun 07:46:16 - [info] Settings file : /root/.node-red/settings.js
1 Jun 07:46:16 - [info] Context store : 'default' [module=memory]
1 Jun 07:46:16 - [info] User directory : /root/.node-red
1 Jun 07:46:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
1 Jun 07:46:16 - [info] Flows file : /root/.node-red/flows_raspbx.json
1 Jun 07:46:16 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

1 Jun 07:46:16 - [info] Starting flows
1 Jun 07:46:17 - [info] Started flows
1 Jun 07:46:17 - [info] Server now running at http://127.0.0.1:1880/
1 Jun 07:46:17 - [info] [mqtt-broker:34ac2466.a0f64c] Connected to broker: node-red@mqtt://192.168.0.110:1883

```

--------\>[Error log](https://termbin.com/65cw). \<-------

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [1 June 2020 07:20 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/32 "2020-06-01T07:20:19Z")

</div>

Why are you installing and running node-red in the root account?

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 07:34 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/33 "2020-06-01T07:34:36Z")

</div>

I guess mainly because I'm installing it on [RasPBX](http://raspberry-asterisk.org). It was working fine for 2+ (also installed under root) before I tried to upgrade.

---

<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:** [1 June 2020 07:44 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/34 "2020-06-01T07:44:31Z")

</div>

Paste the install log `/var/log/nodered-install.log` here, something must have gone wrong there. If it had succeeded then it would not be running as root (assuming you were logged in as a normal user when you ran it, and did not use sudo).  
If you have run the script multiple times then edit the file first so that just the last install is in the log.

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 07:59 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/35 "2020-06-01T07:59:50Z")

</div>

-----\>[Here's my most recent attempt.](https://pastebin.com/jjpnxhZz) \<-----

Remember - it installs fine but will only allow itself to be run if called directly, won't work if called as a service.

`node-red-log` says:

```auto
Started Node-RED graphical event wiring tool.

Node-RED is not yet fully installed
   Can't reach upgrade server - please check your internet connection.

```

The internet connection is fine, I'm ssh into the Pi now from a remote location.

Also the thing about it not being fully installed can't _really_ be true because it runs fine - from a local command.

---

<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:** [1 June 2020 08:07 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/36 "2020-06-01T08:07:50Z")

</div>

cab you run `which node-red` and report the result please ?

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 08:28 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/37 "2020-06-01T08:28:13Z")

</div>

![dasdsa](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b3294e8b5b6a0f157c97e5b97c9d5dfc47000e0c.png)

---

<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:** [1 June 2020 09:41 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/38 "2020-06-01T09:41:22Z")

</div>

so the log from your most recent attempt show you installing it as user nodered... and then the which node-red shows up as root. but when you run it's looking for node-red-pi - which we only call if you're not privileged user. So somewhat confused... as you installed as root can you try `sudo node-red-start` ?

Also look like the serialport isn't happy - can you go into the /root/.node-red dir (as root) and run `npm rebuild`

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 09:53 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/39 "2020-06-01T09:53:56Z")

</div>

Thanks dceeja, feels like we're getting somewhere. It seems like whether it's installed as root or my nodered user, the installation just isn't finishing. Seems like it's a path problem? Like it's confused about where to find the binaries it needs?

 ![Screenshot 2020-05-09 at 14.07.36d](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1a0824665f753bf5de530acfb1b3ed03e080efc.png)

---

<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:** [1 June 2020 10:00 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/40 "2020-06-01T10:00:52Z")

</div>

Humour me... what do `which node` and `sudo which node` report ?

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 10:13 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/41 "2020-06-01T10:13:13Z")

</div>

![which node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/98f2ea765b8a20212d00b52fcd45948ac784641c.png)

EDIT: [Seems similar to these issues](https://www.google.com/search?q=%22%2Fusr%2Fbin%2Fnode-red-start%3A+line+91%3A+update-nodejs-and-nodered%3A+command+not+found%22&oq=%22%2Fusr%2Fbin%2Fnode-red-start%3A+line+91%3A+update-nodejs-and-nodered%3A+command+not+found%22&aqs=chrome..69i57.2142j0j4&sourceid=chrome&ie=UTF-8) and [especially this one](https://discourse.nodered.org/t/node-red-is-not-yet-fully-installed-usr-bin-node-red-start-line-91-update-nodejs-and-nodered-command-not-found/27432)

---

<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:** [1 June 2020 10:38 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/42 "2020-06-01T10:38:30Z")

</div>

yes - but you aren't using nvm...  
ok - digging in.  
Can you edit the `/lib/systemd/system/nodered.service` file and check what the user and group line (about 11 and 12) are set to... - As you are running as root they should be root and root. Then try manually - `sudo systemctl start nodered` and then `sudo journalctl -f -n 0 -u nodered -o cat` to see the log...

[Previous page](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353.md?page=1)

[Next page](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353.md?page=3)
