# Node-red stopped working?

**URL:** <https://discourse.nodered.org/t/node-red-stopped-working/11741>\
**Category:** General\
**Created:** [1 June 2019 08:42 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741 "2019-06-01T08:42:26Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 14:20 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/41 "2019-06-03T14:20:19Z")

</div>

It's very tempting, however, on the Pi is quite a lot of other services that took a while set up. email server, ads-b, pi-hole, openvpn, transmission etc etc.  
Just reinstalling NR seems the best option ...

---

<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:** [3 June 2019 14:30 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/42 "2019-06-03T14:30:23Z")

</div>

You probably used sudo with npm and without -g at some point so that you have set root permissions on .node-red, to recover this run  
`sudo chown -R pi:pi ~/.node-red`

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 14:46 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/43 "2019-06-03T14:46:55Z")

</div>

Thanks Colin, That does ring a bell 🤔

Running sudo chown -R pi:pi ~/.node-red reduced the error count a lot

pi@raspberrypi:~ sudo chown -R pi:pi ~/.node-red pi@raspberrypi:~ cd /home/pi/.node-red  
pi@raspberrypi:~/.node-red $ sudo npm install node-red-contrib-isonline  
npm WARN node-red-project@0.0.1 No repository field.  
npm WARN node-red-project@0.0.1 No license field.

npm ERR! path /home/pi/.node-red/node\_modules/node-telegram-bot-api/node\_modules /.bin/mime  
npm ERR! code EEXIST  
npm ERR! Refusing to delete /home/pi/.node-red/node\_modules/node-telegram-bot-ap i/node\_modules/.bin/mime: is outside /home/pi/.node-red/node\_modules/node-telegr am-bot-api/node\_modules/mime and not a link  
npm ERR! File exists: /home/pi/.node-red/node\_modules/node-telegram-bot-api/node \_modules/.bin/mime  
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:  
npm ERR! /root/.npm/\_logs/2019-06-03T14\_42\_50\_517Z-debug.log  
pi@raspberrypi:~/.node-red $

---

<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:** [3 June 2019 15:04 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/44 "2019-06-03T15:04:14Z")

</div>

You have done it again (using sudo with npm) only do that when installing a node globally (with -g), and only do it if there are specific instructions to do it. Run the `chown` again and try the install again.

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 15:19 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/45 "2019-06-03T15:19:22Z")

</div>

damn it ! so I did I UP arrow'd rather than retype 😧

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 15:39 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/46 "2019-06-03T15:39:38Z")

</div>

Now NR keeps loosing connection

Lost connection to server, reconnecting in 14s ...

---

<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:** [3 June 2019 15:49 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/47 "2019-06-03T15:49:11Z")

</div>

What do you see in the terminal when you stop and restart node red

```bash
node-red-stop
node-red-start

```

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 15:55 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/48 "2019-06-03T15:55:19Z")

</div>

When I connect to 192.168.1.40:1880 it promptly says lost connection to server

pi@raspberrypi:~ $ node-red-stop

Stop Node-RED

Use node-red-start to start Node-RED again

pi@raspberrypi:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at [http://192.168.1.40:1880](http://192.168.1.40: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](http://flows.nodered.org)

# Starting as a systemd service. Started Node-RED graphical event wiring tool. 3 Jun 16:52:11 - [info] Welcome to Node-RED

## 3 Jun 16:52:11 - [info] Node-RED version: v0.20.5 3 Jun 16:52:11 - [info] Node.js version: v10.16.0 3 Jun 16:52:11 - [info] Linux 4.9.35-v7+ arm LE 3 Jun 16:52:13 - [info] Loading palette nodes 3 Jun 16:52:19 - [info] Dashboard up and running 3 Jun 16:52:25 - [info] Worldmap version 2.0.12 3 Jun 16:52:30 - [info] Settings file : /home/pi/.node-red/settings.js 3 Jun 16:52:30 - [info] Context store : 'default' [module=memory] 3 Jun 16:52:30 - [info] User directory : /home/pi/.node-red 3 Jun 16:52:30 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable 3 Jun 16:52:30 - [info] Flows file : /home/pi/.node-red/flows\_raspberrypi.json 3 Jun 16:52:30 - [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.

3 Jun 16:52:30 - [info] Waiting for missing types to be registered:  
3 Jun 16:52:30 - [info] - ui\_base  
3 Jun 16:52:30 - [info] - ui\_tab  
3 Jun 16:52:30 - [info] - ui\_group  
3 Jun 16:52:30 - [info] - darksky-credentials  
3 Jun 16:52:30 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)

---

<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:** [3 June 2019 16:05 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/49 "2019-06-03T16:05:06Z")

</div>

Does the same thing happen if you start it with the --safe option?

```bash
node-red-stop
node-red --safe

```

Also which dashboard node are you running? The message  
`Dashboard up and running`  
is not what I would expect, unless it has changed recently. The supported one is `node-red-dashboard`. Note that you cannot have that and another dashboard node installed at the same time.

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 16:13 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/50 "2019-06-03T16:13:25Z")

</div>

Yes it does the same thing - lost connection. Should be the standard dashboard I've never changed it (knowingly)

---

<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:** [3 June 2019 16:41 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/51 "2019-06-03T16:41:27Z")

</div>

The dashboard is not available unless you install it.  
I don't know why you would get the connection message, perhaps someone else can help

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 16:50 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/52 "2019-06-03T16:50:42Z")

</div>

I'm really tempted to do node-red reinstall but unsure of the best way of doing it. .

At least I still have a backups of all the files..

But I'll wait until I do an  
cd ~/.node-red  
npm rebuild ??

or

bash \<(curl -sL [https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered](https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered))

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 June 2019 18:47 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/53 "2019-06-03T18:47:53Z")

</div>

HI. Here is a way to get back to something better.

- Firstly, rename your ~/.node-red folder to something else.

- Next, uninstall all global npm packages including Node-RED - you will need sudo for that. You can list everything with `sudo npm -g ls --depth=0`.

- As this is a Pi, the next step is to use Dave's excellent script to reinstall Node-RED from scratch.

- Finally, you can start up Node-RED, install the nodes you want using the palette manager and then copy/paste whatever you want from your old flow file.

The problems you've had are one of the reasons I don't ever install Node-RED the "standard" way.

I install Node-RED into its own folder, create a `./data` sub-folder and add a "start" script to the package.json file in the Node-RED root folder that directs Node-RED to use the data folder as its userDir.

That way, you should **never** need to use `sudo` to install any nodes or indeed other packages you might want. Even Node-RED doesn't need to be installed with sudo this way.

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [3 June 2019 19:06 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/54 "2019-06-03T19:06:29Z")

</div>

Thank you, Some questions.

`sudo npm -g ls --depth=0`

returns  
pi@raspberrypi:~ $ sudo npm -g ls --depth=0

/usr/lib  
├── node-red@0.20.5  
└── npm@6.9.0

Where do I find Dave's script ?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 June 2019 19:21 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/55 "2019-06-03T19:21:19Z")

</div>

[https://nodered.org/docs/hardware/raspberrypi](https://nodered.org/docs/hardware/raspberrypi)

I note that you have an old version of Node.js as well. The script will update that for you. It installs everything the "standard" way. You can use the script in the future to update Node.js, npm and Node-RED.

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [4 June 2019 07:45 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/56 "2019-06-04T07:45:59Z")

</div>

@TotallyInformation Well spotted , previously ran 'bash \<(curl -sL [https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered](https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered))' I assumed that would update everything

---

<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:** [4 June 2019 08:00 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/57 "2019-06-04T08:00:09Z")

</div>

It is 10.16.0 that _is_ up to date isn't it?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [4 June 2019 08:23 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/58 "2019-06-04T08:23:35Z")

</div>

Ah, sorry, I missed that 2nd output. You are right, you did manage to update it.

So it looks like you are ready to rebuild your flows. Renaming the ~/.node-red folder at this point and then running Node-RED will give you a completely clean environment to start from.

Before you do though, worth checking that you haven't managed to change permissions on the home folder. `ls ~/* -la` should do the job I think. You will be able to see all of the ownership. If there is any root ownership, I would fix that first.

---

<div class="post-metadata">

**Author:** ![myozone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/myozone/32/8904_2.png) [@myozone](https://discourse.nodered.org/u/myozone)\
**Post date:** [4 June 2019 08:37 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/59 "2019-06-04T08:37:22Z")

</div>

ls ~/\* -la gives a very long list - I forgot how to send it to a file. (Glad the update worked)

I have to go out for a bit (shopping 🙄) but when back I'll do the following

Rename `~/.node-red` to `~/.node-redOLD`  
post the permissions output of `ls ~/* -la` to here then run `bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)`

then reload my flows and update the missing nodes and creds

---

<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:** [4 June 2019 09:05 UTC](https://discourse.nodered.org/t/node-red-stopped-working/11741/60 "2019-06-04T09:05:07Z")

</div>

`ls ~/* -la | grep root`  
will show you if you have any files or folders owned by root.

[Previous page](https://discourse.nodered.org/t/node-red-stopped-working/11741.md?page=2)

[Next page](https://discourse.nodered.org/t/node-red-stopped-working/11741.md?page=4)
