ioBroker/ioBroker.node-red

npm module installation fails with scoped modules

Closed this issue · 3 comments

Adding for example the following module to the instance configuration:
@node-red-contrib-themes/theme-collection

fails with:

Starting node-red: --max-old-space-size=512 /opt/iobroker/node_modules/node-red/red.js -v --settings /opt/iobroker/iobroker-data/node-red/settings.js
Error loading settings file: /opt/iobroker/iobroker-data/node-red/settings.js
node-red exited with 0

Logs are set to "All"

Which adapter version is used? Please provide more information

Node: 18.19.0
Npm: 10.2.3
Iobroker: 5.x (i cannot see it right now on my iPhone)
Node-red adapter: 4.0.3

This seems to work:

ioBroker.node-red/main.js

Lines 313 to 321 in b6d11f2

for (let a = 0; a < additional.length; a++) {
if (additional[a].startsWith('node-red-')) {
continue;
}
npms += ` "${additional[a]}": require("${dir}${additional[a]}")`;
if (a !== additional.length - 1) {
npms += ', \r\n';
}
}

 for (let a = 0; a < additional.length; a++) { 
     if (additional[a].startsWith('node-red-') || additional[a].startsWith('@node-red-')) { 
         continue; 
     } 
     npms += `        "${additional[a]}": require("${dir}${additional[a]}")`; 
     if (a !== additional.length - 1) { 
         npms += ', \r\n'; 
     } 
 } 

Not sure what implications this might have though. The code changed in 5.x, but I think logically it is the same except the linebreaks.