I can't open the node-red

When I start node-red the following message appears:

'''
Welcome to Node-RED

10 Apr 15:42:59 - [info] Node-RED version: v3.1.8
10 Apr 15:42:59 - [info] Node.js version: v20.12.2
10 Apr 15:42:59 - [info] Windows_NT 10.0.22631 x64 LE
10 Apr 15:42:59 - [error] Failed to start server:
10 Apr 15:42:59 - [error] Error: spawn EINVAL
at ChildProcess.spawn (node:internal/child_process:421:11)
at spawn (node:child_process:761:9)
at Object.execFile (node:child_process:351:17)
at C:\Users\ravi1\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\installer.js:581:27
at new Promise ()
at Object.checkPrereq (C:\Users\ravi1\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\installer.js:580:16)
at Object.load (C:\Users\ravi1\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\index.js:59:22)
at C:\Users\ravi1\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\index.js:162:29
'''

How can i fix this error? :thinking:

Have you installed any nodes recently?

Was it working before?

It was my first installation, I never used node-red

I have the same problem. first installation.

Are you installing on Windows too @AliAlAli98 ?

Yes, On windows. I tried installing Node.js 20.12.2 (LTS) version and then tried 18.12.2 (LTS)

Both didn't work

How did you install node & node-red?

Hi, I'm getting the same issue.

Installing on Windows Server 2022 - I've installed on many other windows versions without issue, I'm not sure if this is an issue with this install of Windows or a problem with the current node-red.

I originally installed using

npm install -g --unsafe-perm node-red

and the latest NodeJS v20.

I've since tested using NodeJS v18 and back to early versions of Node-red 3.1 - they all seem to present with the same error. I've also downloaded node-red, extracted, installed manually and hit the same error using:

npm install
npm start
===================

11 Apr 13:31:43 - [info] Node-RED version: v3.1.8
11 Apr 13:31:43 - [info] Node.js  version: v18.20.2
11 Apr 13:31:43 - [info] Windows_NT 10.0.20348 x64 LE
11 Apr 13:31:43 - [error] Failed to start server:
11 Apr 13:31:43 - [error] Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:414:11)
    at spawn (node:child_process:761:9)
    at Object.execFile (node:child_process:351:17)
    at C:\node\node-red\node_modules\@node-red\registry\lib\installer.js:581:27
    at new Promise (<anonymous>)
    at Object.checkPrereq (C:\node\node-red\node_modules\@node-red\registry\lib\installer.js:580:16)
    at Object.load (C:\node\node-red\node_modules\@node-red\registry\lib\index.js:59:22)
    at C:\node\node-red\node_modules\@node-red\runtime\lib\index.js:162:29

Additional checks:

  • Nothing is using port :1880.
  • Running as Administrator
  • Windows defender temporarily disabled - no change

Thanks for the detailed report.

Could I ask a favour before I debug this issue?

Try installing V3.0.2:

npm install -g --unsafe-perm node-red@3.0.2

Does that start up ok?


And also V4 beta:

npm install -g --unsafe-perm node-red@next

Does that start up ok?

Thanks Steve, I think I have tried each of these. Ive also upgraded to Node.js 20 again.

Here's the output from v4 beta:


Welcome to Node-RED
===================

11 Apr 16:02:47 - [info] Node-RED version: v4.0.0-beta.2
11 Apr 16:02:47 - [info] Node.js  version: v20.12.2
11 Apr 16:02:47 - [info] Windows_NT 10.0.20348 x64 LE
11 Apr 16:02:47 - [error] Failed to start server:
11 Apr 16:02:47 - [error] Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at Object.execFile (node:child_process:351:17)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\installer.js:595:27
    at new Promise (<anonymous>)
    at Object.checkPrereq (C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\installer.js:594:16)
    at Object.load (C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js:59:22)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js:164:29

Un-install and re-install with v3.0.2

c:\Users\Administrator\.node-red>npm install -g --unsafe-perm node-red@3.0.2

added 8 packages, removed 8 packages, and changed 295 packages in 5s

45 packages are looking for funding
  run `npm fund` for details

c:\Users\Administrator\.node-red>node-red
11 Apr 16:09:36 - [info]

Welcome to Node-RED
===================

11 Apr 16:09:36 - [info] Node-RED version: v3.0.2
11 Apr 16:09:36 - [info] Node.js  version: v20.12.2
11 Apr 16:09:36 - [info] Windows_NT 10.0.20348 x64 LE
11 Apr 16:09:36 - [error] Failed to start server:
11 Apr 16:09:36 - [error] Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at Object.execFile (node:child_process:351:17)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\installer.js:581:27
    at new Promise (<anonymous>)
    at Object.checkPrereq (C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\installer.js:580:16)
    at Object.load (C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js:59:22)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js:146:29

c:\Users\Administrator\.node-red>

Most odd. I'm now wondering if this is a windows update or recent nodejs issue. I have installed v3.0.x ~ V4beta on win 11 with node 18 many times without issue.

A bit more info gathering:

  • Did you install with
    • an elevated command prompt?
    • Elevated powershell prompt
    • non elevated?
  • Does this happen if you launch node-red with
    • an elevated prompt?
    • a non elevated prompt?

This is a pretty fresh Server 2022 install, it is not part of a Domain so there won't be any customised group polices etc - I'm logged in as Administrator which is still a local admin.
I've been running the NodeJS installer and NPM commands as this user, executing the node-red.cmd with "Run as Administrator" makes no difference.

NodeJS was run by just double clicking the installer.
I'm attempting to remove everything again and perhaps try as a different user.

I also can't see anything obvious in the Windows event logs regarding security etc.

You shouldn't need to uninstall anything but it won't harm either.

This was going to be my last suggestion but I seen others did not run with account named Administrator - worth a shot though.

This is very odd indeed.

In your trials, would you also please try a specific node version: v18.19.0 - I have this on my development machine and it rings node-red without issue.

Ok, well now I am up and running.

Here's everything I did in order -

  • Uninstall everything possible via NPM
  • Remove NodeJS
  • Manually delete any NPM folders left laying around
  • Let windows update run (I'm now 21H2, was 21H1 previously).
  • Reboot & Log in as another user
  • Install NodeJS 18.19.0
  • Install Node-red 3.0.2.
  • Start it

I can only assume that Node or NPM made a mess of things initially and something was always left behind.

I've also just run NPM update and node-red 3.1.8 is now starting without issue!

That's the version that works for me. From your posts I guess you used the latest LTS of v20 and v18. I am super curious to know if the latest node version is to blame.

Cna you please specify how did you uninstall everything in NPM? Which prompt did you use? With remove Nodejs, you mean uninstall, right? I am going to repeat your steps, as I have the same issue.

i tried 18 and 20 both, same problem.
Error: spawn EINVAL