Error loading node-red

I'm getting error while running node-red. I followed the forum:

Added the DEBUG line & getting the details as follows.

SyntaxError: missing ) after argument list
at Object.compileFunction (node:vm:353:18)
at wrapSafe (node:internal/modules/cjs/loader:1039:15)
at Module._compile (node:internal/modules/cjs/loader:1073:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object. (C:\Users\Sahil\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\index.js:27:16)
at Module._compile (node:internal/modules/cjs/loader:1109:14)

Can anyone help what should be done next?

If you added the debug lines as Nick suggested...

... what was the reason for adding those?

What error were you getting that prompted you add these debug lines?

Just as the post suggested to find out the node causing the error. So I can "npm remove" the node. :confused:

This was the error I was getting:

Welcome to Node-RED

16 Jun 11:54:53 - [info] Node-RED version: v1.3.5
16 Jun 11:54:53 - [info] Node.js version: v16.3.0
16 Jun 11:54:53 - [info] Windows_NT 10.0.19042 x64 LE
16 Jun 11:54:58 - [info] Loading palette nodes
16 Jun 11:55:05 - [error] Failed to start server:
16 Jun 11:55:05 - [error] TypeError: Cannot read property 'forEach' of undefined
at Object.addModule (C:\Users\Sahil\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\registry.js:195:27)
at C:\Users\Sahil\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\loader.js:153:34

ok, I get that, however the original error on that post is TypeError: Cannot read property 'forEach' of undefined

You are getting SyntaxError: missing ) after argument list

This suggests you have a different problem OR you have made a mistake when adding the debug lines.

so I will ask again, what error were you getting (originally) before you added these debug lines?

I see you edited your post while I was typing.

Ok, so you have possibly made a mistake when adding the debug lines causing the error SyntaxError: missing ) after argument list.

Show us a few lines before and a few lines after where you added the debug code.

Before adding the debug line this was shown:

Try putting a catch node connected to a debug node (set to display the complete msg object) in the flow and see if it shows anything.

I panicked and got caught up in a cycle of re-installing node.js & even downgraded to previous build of windows 10.
1

Thought it over again and gave a another try & deleted the last node I added "ui-etable" manually from location
C:\Users\user-name\ .node-red\node_modules
It seems to be working now.
2

Overkill

Extreme overkill.


The worst you would need to do is delete node modules / clear npm cache OR downgrade node js to LTS version.

"node-red-node-ui-etable" appeared again
screenshot 2

and so node-red has stopped again
screenshot 3

when I delete the folder it works for some while then it re-appears and sever disconnects.
Have I done something wrong which is causing this?
:confused:

it is probably in package.json

  • open a command prompt & uninstall it property...

    cd c:\users\Sahil\.node-red
    npm uninstall node-red-node-ui-etable
    
  • check folder is gone from c:\users\Sahil\.node-red\node_modules

  • restart node-red

Flows have started but also showing the below warning

(node:5628) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\Sahil.node-red\node_modules\node-red-dashboard\package.json' of 'none'. Please either fix that or report it to the module author

I suspect you are using node-js v16 - this is noted & it is only a waring - your problem is fixed.

Yes, I'm using node-v16.3.0. Thankyou.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.