I've been using node-red for a couple of years on my home-server. Recently I updated some npm packages and restarted the server and now it's failing to run.
The output from journalctl when running the service hints to some sort of opcode issue (which I have no idea).
alpha@home-server:~$ sudo service node-red start && journalctl -f
-- Logs begin at Mon 2019-03-11 18:34:40 CET. --
Aug 03 20:50:21 home-server node-red[32320]: 3 Aug 20:50:21 - [info]
Aug 03 20:50:21 home-server node-red[32320]: Welcome to Node-RED
Aug 03 20:50:21 home-server node-red[32320]: ===================
Aug 03 20:50:21 home-server node-red[32320]: 3 Aug 20:50:21 - [info] Node-RED version: v2.0.5
Aug 03 20:50:21 home-server node-red[32320]: 3 Aug 20:50:21 - [info] Node.js version: v12.22.4
Aug 03 20:50:21 home-server node-red[32320]: 3 Aug 20:50:21 - [info] Linux 4.15.0-151-generic x64 LE
Aug 03 20:50:23 home-server node-red[32320]: 3 Aug 20:50:23 - [info] Loading palette nodes
Aug 03 20:50:27 home-server kernel: traps: node[32320] trap invalid opcode ip:7fdf2edc1f1f sp:7ffc69beb148 error:0 in libvips-cpp.so.42[7fdf2eb8f000+c9e000]
Aug 03 20:50:28 home-server systemd[1]: node-red.service: Main process exited, code=dumped, status=4/ILL
Aug 03 20:50:28 home-server systemd[1]: node-red.service: Failed with result 'core-dump'.
Aug 03 20:50:28 home-server systemd[1]: node-red.service: Service hold-off time over, scheduling restart.
Aug 03 20:50:28 home-server systemd[1]: node-red.service: Scheduled restart job, restart counter is at 1.
Aug 03 20:50:28 home-server systemd[1]: Stopped Node-RED.
It enters into a loop where it's keep on crashing and restarting. I tried to google the opcode issue, but couldn't find anything useful.
Also, launching the node-red on terminal causes the following output:
alpha@home-server:~$ node-red
3 Aug 20:44:42 - [info]
Welcome to Node-RED
===================
3 Aug 20:44:42 - [info] Node-RED version: v2.0.5
3 Aug 20:44:42 - [info] Node.js version: v12.22.4
3 Aug 20:44:42 - [info] Linux 4.15.0-151-generic x64 LE
3 Aug 20:44:44 - [info] Loading palette nodes
Illegal instruction (core dumped)
Is there any way to know which node when loading the pallet is causing the issue?
I tried launching node-red with an empty flow too and still experienced the same behavior.
Any help would be appreciated.
Normally you can start node red using node-red --safe
and it will open the editor but not start the flows. However that may not help here as it may be crashing while loading the editor.
Did you run npm rebuild
in the .node-red folder after upgrading nodejs? If not then that may be the cause of the crash.
You can remove nodes that you think might be causing the problem by going into the .node-red folder and running, for example, npm remove node-red-contrib-whatever
that will prevent it loading the node when you start node-red so when the other nodes have been loaded you will get a message something like Unable to start node-red due to missing nodes. Then you can remove those nodes from the flow, or re-install them from within node-red.
It turns out that a package which I installed from node-red but never really used was causing all the troubles.
I did grep for libvips in the installed modules and found out that it was being used in a package called sharp which is again used by node-red-contrib-onvif.
alpha@home-server:~/.node-red$ npm ls sharp
node-red-project@0.0.1 /home/alpha/.node-red
└─┬ node-red-contrib-onvif@1.0.3
└── sharp@0.28.3
Upon uninstalling node-red-contrib-onvif, the problem has been resolved.