Starting a new project so figured it would be good to start with the latest release of node-red. Per the nodered.org site, I ran this from the Windows command prompt thinking it would do the trick: npm install -g --unsafe-perm node-red
After allowing this to run, attempted to restart node-red and, unfortunately, that didn't go as expected. Nothing I have found thus far have allowed me to correct the problem. Any guidance is appreciated.
C:\Users\Ray>node-red
node:internal/modules/cjs/loader:927
throw err;
^
Error: Cannot find module 'node:dns'
Require stack:
- C:\Users\Ray\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\Ray\AppData\Roaming\npm\node_modules\node-red\red.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\Ray\AppData\Roaming\npm\node_modules\node-red\lib\red.js:30:17)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Ray\\AppData\\Roaming\\npm\\node_modules\\node-red\\lib\\red.js',
'C:\\Users\\Ray\\AppData\\Roaming\\npm\\node_modules\\node-red\\red.js'
]
}
What version of Node-RED and node.js do you have installed? I think that the node.js node:dns module is only available from node.js v18. It was called dns before.
The blog entry for rhe release of v3.1 led to the get started page where with the command shown above to upgrade. No version is referenced so assume it would pull the latest at 3.1.x. https://nodered.org/docs/getting-started/local
It is mentioned on that page, as you referenced in your reply, a compatable version of jode.js. I will check/upgrade and report back.
@knolleary , @Steve-Mcl - is this a bug in the latest release of Node-RED? As Node-RED v3 is meant to be baselined against Node.js v14, I think it should be using the dns module and not node:dns?
In this instance,we want to call a function of the DNS module that was introduced after Node 14 - which is why it makes the check. That said, you are quite right that it doesn't need to use the node: prefix either way.
I have another bug to fix before anyone sees it in the wild and will be doing 3.1.5 release in the next 24 hours. I'll update this require statement as well.