# While starting node-red getting exception in ubuntu snappy

**URL:** <https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682>\
**Category:** General\
**Created:** [14 October 2019 10:02 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682 "2019-10-14T10:02:50Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 10:02 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/1 "2019-10-14T10:02:50Z")

</div>

In ubuntu snappy OS I have installed the node-red but while starting I'm getting exception like:

```auto
Oct 14 10:12:23 admin node-red.node-red[3741]: Welcome to Node-RED
Oct 14 10:12:23 admin node-red.node-red[3741]: ===================
Oct 14 10:12:23 admin node-red.node-red[3741]: 14 Oct 10:12:23 - [info] Node-RED version: v1.0.1
Oct 14 10:12:23 admin node-red.node-red[3741]: 14 Oct 10:12:23 - [info] Node.js version: v10.16.3
Oct 14 10:12:23 admin node-red.node-red[3741]: 14 Oct 10:12:23 - [info] Linux 4.4.0-164-generic x64 LE
Oct 14 10:12:24 admin node-red.node-red[3741]: 14 Oct 10:12:24 - [info] Loading palette nodes
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] Settings file : /root/snap/node-red/503/settings.js
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] Context store : 'default' [module=memory]
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] User directory : /root/snap/node-red/503
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [warn] Projects disabled : editorTheme.projects.enabled=false
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] Flows file : /root/snap/node-red/503/flows.json
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] Server now running at http://127.0.0.1:1880/
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [warn]
Oct 14 10:12:28 admin node-red.node-red[3741]: ---------------------------------------------------------------------
Oct 14 10:12:28 admin node-red.node-red[3741]: Your flow credentials file is encrypted using a system-generated key.
Oct 14 10:12:28 admin node-red.node-red[3741]: If the system-generated key is lost for any reason, your credentials
Oct 14 10:12:28 admin node-red.node-red[3741]: file will not be recoverable, you will have to delete it and re-enter
Oct 14 10:12:28 admin node-red.node-red[3741]: your credentials.
Oct 14 10:12:28 admin node-red.node-red[3741]: You should set your own key using the 'credentialSecret' option in
Oct 14 10:12:28 admin node-red.node-red[3741]: your settings file. Node-RED will then re-encrypt your credentials
Oct 14 10:12:28 admin node-red.node-red[3741]: file using your chosen key the next time you deploy a change.
Oct 14 10:12:28 admin node-red.node-red[3741]: ---------------------------------------------------------------------
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] Starting flows
Oct 14 10:12:28 admin node-red.node-red[3741]: 14 Oct 10:12:28 - [info] Started flows
Oct 14 10:12:29 admin node-red.node-red[3741]: 14 Oct 10:12:29 - [info] [mqtt-broker:5bb44be3.f0b5bc] Connected to broker: tcp://test.testhub.in:1883
Oct 14 10:12:29 admin node-red.node-red[3741]: 0
Oct 14 10:12:29 admin node-red.node-red[3741]: 0
Oct 14 10:12:29 admin node-red.node-red[3741]: 0
Oct 14 10:12:29 admin node-red.node-red[3741]: 0
Oct 14 10:12:29 admin node-red.node-red[3741]: 0
Oct 14 10:12:29 admin node-red.node-red[3741]: 0
Oct 14 10:12:29 admin node-red.node-red[3741]: 14 Oct 10:12:29 - [red] Uncaught Exception:
Oct 14 10:12:29 admin node-red.node-red[3741]: 14 Oct 10:12:29 - Error: spawn /root/snap/node-red/503/node_modules/node-red-contrib-lwm2m/dist/binding/node-v64-linux-x64/wakatiwaiclient ENOENT
Oct 14 10:12:29 admin node-red.node-red[3741]: at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
Oct 14 10:12:29 admin node-red.node-red[3741]: at onErrorNT (internal/child_process.js:415:16)
Oct 14 10:12:29 admin node-red.node-red[3741]: at process._tickCallback (internal/process/next_tick.js:63:19)
Oct 14 10:12:29 admin systemd[1]: snap.node-red.node-red.service: Main process exited, code=exited, status=1/FAILURE
Oct 14 10:12:29 admin systemd[1]: snap.node-red.node-red.service: Unit entered failed state.
Oct 14 10:12:29 admin systemd[1]: snap.node-red.node-red.service: Failed with result 'exit-code'.
Oct 14 10:12:29 admin systemd[1]: snap.node-red.node-red.service: Service hold-off time over, scheduling restart.
Oct 14 10:12:29 admin systemd[1]: Stopped Service for snap application node-red.node-red.
Oct 14 10:12:29 admin systemd[1]: Started Service for snap application node-red.node-red.
Oct 14 10:12:29 admin node-red.node-red[3844]: NOW STARTING NODE-RED : /snap/node-red/503/bin/node-red -u /root/snap/node-red/503 on port 1880
Oct 14 10:12:31 admin node-red.node-red[3844]: 14 Oct 10:12:31 - [info]
Oct 14 10:12:31 admin node-red.node-red[3844]: Welcome to Node-RED
Oct 14 10:12:31 admin node-red.node-red[3844]: ===================
Oct 14 10:12:31 admin node-red.node-red[3844]: 14 Oct 10:12:31 - [info] Node-RED version: v1.0.1
Oct 14 10:12:31 admin node-red.node-red[3844]: 14 Oct 10:12:31 - [info] Node.js version: v10.16.3
Oct 14 10:12:31 admin node-red.node-red[3844]: 14 Oct 10:12:31 - [info] Linux 4.4.0-164-generic x64 LE
Oct 14 10:12:32 admin node-red.node-red[3844]: 14 Oct 10:12:32 - [info] Loading palette nodes

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 October 2019 10:04 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/2 "2019-10-14T10:04:50Z")

</div>

Hi @VIKRAMAS

the log you've shared doesn't go far enough back to show what the actual error is.

---

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 10:15 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/4 "2019-10-14T10:15:13Z")

</div>

By the log I got lwm2m node is causing the exception and it is not allowing it to start. How can I remove that module and start.

---

<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:** [14 October 2019 10:23 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/5 "2019-10-14T10:23:47Z")

</div>

Looks like [node-red-contrib-lwm2m](https://github.com/CANDY-LINE/node-red-contrib-lwm2m) is the issue

You should raise this issue on the [node-red-contrib-lwm2m github repo](https://github.com/CANDY-LINE/node-red-contrib-lwm2m/issues) (so it gets fixed for everyone)

I dont know how ubuntu snappy starts node-red but you have a few choices - 2 of them below...

1. Start node-red in safe-mode and remove the node (add `--safe` to the startup command line)
2. Rename your flow file `/root/snap/node-red/503/flows.json` to something else so that it is not found.(node-red will create a new blank flow when its restarted)

there are lots of threads covering how to do both of these things (search this forum on things like `safe mode` or `flow file`)

---

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 10:28 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/6 "2019-10-14T10:28:37Z")

</div>

> [@Steve-Mcl](#):
>
> safe mode

I tries to start in safe mode `snap start node-red --safe` but it gave exception like:  
`error: unknown flag `safe'`

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 October 2019 10:30 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/7 "2019-10-14T10:30:48Z")

</div>

> [@VIKRAMAS](#):
>
> I tries to start in safe mode `snap start node-red --safe` but it gave exception like:  
> `error: unknown flag ` safe'`

The `--safe` flag is used with the main `node-red` command. That is not the same thing as running `snap start node-red`.

To uninstall that module, you will need to run `npm remove node-red-contrib-lwm2m ` in the directory `/root/snap/node-red/503`.

---

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 10:32 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/8 "2019-10-14T10:32:56Z")

</div>

> [@knolleary](#):
>
> npm remove node-red-contrib-lwm2m

when I ran `npm remove node-red-contrib-lwm2m` it gave exception like :

```auto
Command "npm" not found, did you mean:

 command "nsm" from snap "nift"

See 'snap info <snap name>' for additional versions.

```

---

<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:** [14 October 2019 10:44 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/9 "2019-10-14T10:44:19Z")

</div>

Just my 2 cents...

1. uninstall from snap
2. use the [install script](https://nodered.org/docs/getting-started/raspberrypi)

Sorted.

---

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 10:51 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/10 "2019-10-14T10:51:13Z")

</div>

is there any way to start without uninstalling node-red.

---

<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:** [14 October 2019 11:04 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/11 "2019-10-14T11:04:56Z")

</div>

That wasnt really the point.

- you have issues like `Command "npm" not found` etc.

- This script installs Node-red and all necessary components in a manor familiar to pretty much everyone on this forum.

- Your current install method of node-red is not as well widely used & therefore your level of support may be diminished.

To demonstrate this point - due to your current install method, I dont know how to assist you. 😆

---

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 11:39 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/12 "2019-10-14T11:39:11Z")

</div>

As npm command is not working is there any other alternate option for removing node-red-contrib-lwm2m module.

---

<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:** [14 October 2019 13:37 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/13 "2019-10-14T13:37:26Z")

</div>

- one day someone will read a README... but until then

> **[dceejay/nodered.snap](https://github.com/dceejay/nodered.snap)**
>
> Node RED snappy package. Contribute to dceejay/nodered.snap development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![VIKRAMAS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikramas/32/3955_2.png) [@VIKRAMAS](https://discourse.nodered.org/u/VIKRAMAS)\
**Post date:** [14 October 2019 13:52 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/14 "2019-10-14T13:52:42Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/ed3293f2842f9aa56b6c0299023999927dbbe4df.png)  
I have deleted the lwm2m client using command now flows are not started beacuse the lwm2m client was in use, but I have only one flow that too it don't have any lwm2m flow.

The new log is:

```auto
root@admin:~/snap/node-red/current# journalctl -f -u snap.node-red*
-- Logs begin at Mon 2019-10-14 11:17:29 UTC. --
Oct 14 13:45:54 admin node-red.node-red[14971]: Your flow credentials file is encrypted using a system-generated key.
Oct 14 13:45:54 admin node-red.node-red[14971]: If the system-generated key is lost for any reason, your credentials
Oct 14 13:45:54 admin node-red.node-red[14971]: file will not be recoverable, you will have to delete it and re-enter
Oct 14 13:45:54 admin node-red.node-red[14971]: your credentials.
Oct 14 13:45:54 admin node-red.node-red[14971]: You should set your own key using the 'credentialSecret' option in
Oct 14 13:45:54 admin node-red.node-red[14971]: your settings file. Node-RED will then re-encrypt your credentials
Oct 14 13:45:54 admin node-red.node-red[14971]: file using your chosen key the next time you deploy a change.
Oct 14 13:45:54 admin node-red.node-red[14971]: ---------------------------------------------------------------------
Oct 14 13:45:54 admin node-red.node-red[14971]: 14 Oct 13:45:54 - [info] Waiting for missing types to be registered:
Oct 14 13:45:54 admin node-red.node-red[14971]: 14 Oct 13:45:54 - [info] - lwm2m client
Oct 14 13:47:25 admin node-red.node-red[14971]: 14 Oct 13:47:25 - [info] Stopping flows
Oct 14 13:47:25 admin node-red.node-red[14971]: 14 Oct 13:47:25 - [info] Stopped flows
Oct 14 13:47:25 admin node-red.node-red[14971]: 14 Oct 13:47:25 - [info] Waiting for missing types to be registered:
Oct 14 13:47:25 admin node-red.node-red[14971]: 14 Oct 13:47:25 - [info] - lwm2m client
Oct 14 13:48:19 admin node-red.node-red[14971]: 14 Oct 13:48:19 - [info] Stopping flows
Oct 14 13:48:19 admin node-red.node-red[14971]: 14 Oct 13:48:19 - [info] Stopped flows
Oct 14 13:48:19 admin node-red.node-red[14971]: 14 Oct 13:48:19 - [info] Waiting for missing types to be registered:
Oct 14 13:48:19 admin node-red.node-red[14971]: 14 Oct 13:48:19 - [info] - lwm2m client

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 October 2019 14:02 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/15 "2019-10-14T14:02:34Z")

</div>

In your screenshot you have searched for `lwm` and the results show you have a node of _unknown_ type called `lwm2m client`. That is what you need to delete.

Select it in the search results to 'find' it in your workspace. Then delete it and deploy. It _might_ be a configuration node, in which case you should look in the Config Node sidebar panel.

---

<div class="post-metadata">

**Author:** ![GoodFaithParadigm8](https://avatars.discourse-cdn.com/v4/letter/g/6a8cbe/32.png) [@GoodFaithParadigm8](https://discourse.nodered.org/u/GoodFaithParadigm8)\
**Post date:** [27 June 2020 21:43 UTC](https://discourse.nodered.org/t/while-starting-node-red-getting-exception-in-ubuntu-snappy/16682/16 "2020-06-27T21:43:16Z")

</div>

I freed up a port on my machine. Thank you for posting that here. To be honest I was unaware where node-red was installed until I ran `ps aux | grep node`. I had no idea I installed a snap version, I've gotten so used to using Docker for everything.
