While starting node-red getting exception in ubuntu snappy

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

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

Hi @VIKRAMAS

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

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.

Looks like node-red-contrib-lwm2m is the issue

You should raise this issue on the node-red-contrib-lwm2m github repo (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)

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.

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

Command "npm" not found, did you mean:

 command "nsm" from snap "nift"

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

Just my 2 cents...

  1. uninstall from snap
  2. use the install script

Sorted.

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

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. :laughing:

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

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

3 Likes


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:

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

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.

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.