Help. Killed my Node Red with update

Hi, I seem to have managed to screw up my Node Red Installation (Running Win7 on a stand alone machine).

I had tried to run an update without realising that the latest versions of nodejs are no longer supporting Win 7. I have done a windows rollback and re-installed my old version of nodejs and npm but Node Red will not start correctly (see attached log)

I did a backup of my .node-red directory before starting the update but the old directory and files still appears intact so I'm uncertain if I need to copy the backup back to the original directory.

Thought I would run this past the experts before screwing things up further. Hope someone can offer a helpful suggestion.

Rename the current .node-red folder (just in case) and restore it from your backup.

the error is complaining about package.json.... so you need to check what has messed up in there. It is obviously broken somehow - there was an issue with Node-RED 1.2.0 (or so - but now corrected since 1.2.2 I think) - where npm would add invalid characters to dependency package names. You can share your package.json here if it would help.

Thanks. I have attached the package.json in case you spot something. I can't see a problem but that does not mean there is not one.

{
"name": "node-red-project",
"description": "A Node-RED Project",
"version": "0.0.1",
"private": true,
"dependencies": {
"canvas-gauges": "^2.1.5",
"riot": "^3.6.1"
"node-red-contrib-alarm": "~0.9.9",
"node-red-contrib-alexa-home-skill": "~0.1.17",
"node-red-contrib-binance": "~0.1.7",
"node-red-contrib-browser-utils": "0.0.8",
"node-red-contrib-heater-controller": "~1.2.0",
"node-red-contrib-jquerify": "0.0.6",
"node-red-contrib-light-fx": "^0.1.3",
"node-red-contrib-nora": "0.0.19",
"node-red-contrib-power-monitor": "~0.1.2",
"node-red-contrib-ramp-thermostat": "~0.8.1",
"node-red-contrib-telegrambot": "^4.8.0",
"node-red-contrib-telegrambot-home": "~0.5.1",
"node-red-contrib-thingspeak": "0.0.4",
"node-red-contrib-thingspeak42": "~0.1.4",
"node-red-contrib-timeout": "^1.1.1",
"node-red-contrib-uibuilder": "~1.0.10",
"node-red-contrib-web-worldmap": "^1.5.16",
"node-red-dashboard": "~2.10.0",
"node-red-node-base64": "~0.1.3",
"node-red-node-fitbit": "~0.1.0",
"node-red-node-openweathermap": "~0.2.1",
"node-red-node-pushover": "0.0.14",
"node-red-node-random": "~0.1.2",
"node-red-node-serialport": "~0.6.8",
"node-red-node-sqlite": "^0.3.6"
}
}package.json (1.4 KB)

Thanks Colin, tried it but no difference. Still the same message.

There is no comma at the end of the riot line... did you manually edit that in ?
( jsonlint.com is a great site to quickly check validity)

Hmm. Not sure how that happened dceejay. I loaded the file again in notepad ++ from the .node-red directory and the the comma is there correctly. Not sure why it did not paste across.

Still does not load Node Red though. Exactly the same errors.

Has me scratching my head. Luckly I backed up my flows and I can still run them on my Pi but I use my PC for development work so would prefer getting it running again. Do appreciate any suggestions.

well if it is there then you wont get that error - so maybe edit it again - and then show us the error again.

Thanks, I re-edited the package file this time using Atom and the comma was missing. Strange. Having re-inserted the comma I saved the file back and tried restarting Node Red. This time I got a different much longer error message as pasted below.

Preformatted text.
Your environment has been set up for using Node.js 12.20.0 (x64) and npm.

C:\Users\Michael>node-red
2 Jan 16:05:14 - [info]

Welcome to Node-RED

2 Jan 16:05:14 - [info] Node-RED version: v1.2.6
2 Jan 16:05:14 - [info] Node.js version: v12.20.0
2 Jan 16:05:14 - [info] Windows_NT 6.1.7601 x64 LE
2 Jan 16:05:14 - [info] Loading palette nodes
2 Jan 16:05:16 - [info] Dashboard version 2.26.1 started at /ui
2 Jan 16:05:16 - [warn] ------------------------------------------------------
2 Jan 16:05:16 - [warn] [node-red-contrib-viseo-ffmpeg/ffmpeg-command] Error: Ca
nnot find module 'node-red-viseo-helper'
Require stack:

  • C:\Users\Michael.node-red\node_modules\node-red-contrib-viseo-ffmpeg\node-ffm
    peg-command.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\registry\lib\loader.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\registry\lib\index.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\runtime\lib\nodes\index.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\runtime\lib\index.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\lib\red.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\red.js
    2 Jan 16:05:16 - [warn] [node-red-contrib-rfxcom/rfxcom] Error: The module '\?
    C:\Users\Michael.node-red\node_modules@serialport\bindings\build\Release\bindi
    ngs.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 48. 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).
    2 Jan 16:05:16 - [warn] [node-red-node-serialport/serialport] Error: The module
    '\?\C:\Users\Michael.node-red\node_modules\node-red-node-serialport\node_modul
    es@serialport\bindings\build\Release\bindings.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 48. 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).
    2 Jan 16:05:16 - [warn] [node-red-contrib-join/join] Type already registered
    2 Jan 16:05:16 - [warn] [node-red-contrib-node-tradfri/tradfri] Error: Cannot fi
    nd module 'C:\Users\Michael.node-red\node_modules\node-aead-crypto\build\Releas
    e\node-v72-win32-x64\node_aead_crypto.node'
    Require stack:
  • C:\Users\Michael.node-red\node_modules\node-aead-crypto\index.js
  • C:\Users\Michael.node-red\node_modules\node-dtls-client\build\TLS\AEADCipher.
    js
  • C:\Users\Michael.node-red\node_modules\node-dtls-client\build\TLS\CipherSuite
    .js
  • C:\Users\Michael.node-red\node_modules\node-dtls-client\build\DTLS\Handshake.
    js
  • C:\Users\Michael.node-red\node_modules\node-dtls-client\build\dtls.js
  • C:\Users\Michael.node-red\node_modules\node-coap-client\build\CoapClient.js
  • C:\Users\Michael.node-red\node_modules\node-red-contrib-node-tradfri\node_mod
    ules\node-tradfri-client\build\tradfri-client.js
  • C:\Users\Michael.node-red\node_modules\node-red-contrib-node-tradfri\node_mod
    ules\node-tradfri-client\build\index.js
  • C:\Users\Michael.node-red\node_modules\node-red-contrib-node-tradfri\dist\nod
    e-tradfri.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\registry\lib\loader.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\registry\lib\index.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\runtime\lib\nodes\index.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\node_modules@node-
    red\runtime\lib\index.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\lib\red.js
  • C:\Users\Michael\AppData\Roaming\npm\node_modules\node-red\red.js
    2 Jan 16:05:16 - [warn] ------------------------------------------------------
    2 Jan 16:05:16 - [info] Settings file : \Users\Michael.node-red\settings.js
    2 Jan 16:05:16 - [info] HTTP Static : C:\Users\Michael\node-red-static
    2 Jan 16:05:16 - [info] Context store : 'default' [module=memory]
    2 Jan 16:05:16 - [info] User directory : \Users\Michael.node-red
    2 Jan 16:05:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
    2 Jan 16:05:16 - [info] Flows file : \Users\Michael.node-red\flows_MichaelP
    hoto-PC.json
    2 Jan 16:05:16 - [error] Unable to listen on http://127.0.0.1:1880/
    2 Jan 16:05:16 - [error] Error: port in use

C:\Users\Michael>

You have not restored the original version of nodejs, or you rebuilt the nodes with a different version and have now restored the original.
Go into your .node-red folder and run
npm rebuild
and
npm install
which should sort that problem out.

Huge thanks. You guys are heros. I have Node Red back. Only minor problem is I am missing a couple of Nodes that I had installed previously but I can soon sort that. Once again thank you.

Excellent.
You didn't answer the question earlier about whether you had been manually editing package.json. That shouldn't normally be necessary.

No. I had not touched it. To be honest I leave those files alone. I first set up Node-Red about 15 months ago and I am still on a steep learning curve. I do get some errors when I try to update nodes and I suspect that has something to do with my original setup and directories.

Purclewan.

1 Like