Unable to start node-red

Hi all,
I have been facing an issue in starting node-red and am unable to figure out why is it happening. The following is the error that it throws whenever i start node-red. I hope you can help me out.

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

12 Dec 17:50:30 - [info] Node-RED version: v1.0.3
12 Dec 17:50:30 - [info] Node.js  version: v12.10.0
12 Dec 17:50:30 - [info] Windows_NT 10.0.17134 x64 LE
12 Dec 17:50:32 - [info] Loading palette nodes
12 Dec 17:50:33 - [error] Failed to start server:
12 Dec 17:50:33 - [error] TypeError: Cannot read property 'forEach' of undefined
    at Object.addModule (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\registry.js:186:27)
    at d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js:108:30
    at tryCatchReject (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:845:30)
    at runContinuation1 (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:804:4)
    at Fulfilled.when (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:592:4)
    at Pending.run (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:483:13)
    at Scheduler._drain (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\Scheduler.js:62:19)
    at Scheduler.drain (d:\Profiles\gupta\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\Scheduler.js:27:9)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
1 Like

This probably happened after you added a node in. Can you remember what you did before it happened?

You can start NR in safe mode using the --safe option and fix whatever you did.

That won't work in this instance as the error is happening whilst loading the palette of nodes, long before the flows are loaded.

It would be good to know if you've added any new nodes recently. This error crops up from time to time but I don't think we know definitively what causes it. But a badly implemented module could do it.

3 Likes

Yes. I did install the AMQP module. ( node-red-contrib-amqp).
But i did install a fresh node-red after that which still isn't working.

To see if the problem is with node-red-contrib-amqp, if you are using a Pi (you didn't mention the platform) you could

  1. stop node-red
  2. open a terminal window
  3. enter cd .node-red/node_modules
  4. delete the folder with rm -rf node-red-contrib-amqp
  5. restart node-red

see if you get in now.

oh right, i am using it on windows. not on a pi.

you should still be able to remove it by opening a command prompt and changing to your node red directory (\Users<Username>.node-red) and then entering
npm remove node-red-contrib-amqp
and then starting node-red

it still didn't work..

Is it giving the same error?
Didi you install any other nodes?

Yes, the error is still the same. and No. I did not install any other node. although i have tried to uninstall node-red using npm and deleted the folder from appdata (from temp and roaming folder). But it still didn't work..

What other nodes do you have installed? You should be able to go to \Users\<Username>\.node-red\node_modules and list all the files starting with node-red-... and that should show all the node-red and contrib modules.

There are no extra modules installed. Only the default modules are there.

I'm at a loss, maybe someone else will have an idea.

Shouldn't that be npm uninstall node-red-contrib-amqp

Oops, you are right, mixing my ‘npm’ and ‘apt’. Thanks for catching that

unfortunately, even this didn't work.!

I had the same problem. From your log it seems you are using Windows. I had to manually remove the folder from %APPDATA%\npm\node_modules

I've got the same issue on Windows 10. Removed all amqp related folders from \Users<Username>.node-red\node_modules\ and managed to start again.

Hi Sakshi,

To completely remove the module you need to follow below steps:

  1. Do npm uninstall node-red-contrib-amqp
  2. npm uninstall @node-red-tools/node-red-contrib-amqp
  3. Find traces of the module in the location : C:\Users\<Your_PC_username>\.node-red\node_modules\
  4. Delete node-red-contrib-amqp folder if any
  5. Now go to .config.json at location "C:\Users\<Your_PC_username>\.node-red"
  6. Delete the node-red-contrib-amqp module mentioned in .config.json. So, it will not load the setting while starting the node red.

Note: Please change the drive name accordingly.

Let me know if it works!

1 Like

Please someone help me in this I have the same problem and I can't solve and i need to work with node-red