Connection refused after editing settings.js


#1

Hello there, i have a little problem like the title tells.
I installed modules like xml2js & fast-csv on my host and want to use those functions inside a function node in nodered.
So i added the modules to 'functionGlobalContext' inside settings.js (.node-red -> settings.js)
but then after restart i cannot connect to nodered in browser, it says err_connection_refused.
btw, nodered is installed in a docker container..
did i installed the modules the wrong way? what is the problem, i hope somebody can help.
**i installed the modules globally, but in the root directory..

best regards,
Paul


#2

Do you have access to the node-red log to see what error it is hitting?

Can you share exactly what you put in the settings.js file? You've probably accidentally introduced a syntax error in the file which prevents it from being loaded.


#3

unfortunately, i cannot access the host system.. that means i cannot read the log right?
I'm only getting access by ssh into the container and through portainer.io .

this is what i've edited in the settings file
functionGlobalContext: {
nodes7:require('nodes7')
// fast-csv:require('fast-csv'),
// xml2js:require('xml2js')
...
nodes7 is working in a function node but the others wont.

i also installed them right into the .node-red folder but nothing changed


#4

The fast-csv and xml2js lines are commented out - remove the // at the start of them. You'll also need a comma, , to separate the nodes7 and fast-csv lines. Finally, you'll need to rename fast-csv as that is not a valid javascript identifier - use fastCSV (as an example).

functionGlobalContext: {
  nodes7:require('nodes7'),
  fastCSV:require('fast-csv'),
  xml2js:require('xml2js')
}

And make sure there is a comma separating this whole block from the settings above and below.


#5

lol yes for sure, i just commented it out so that i could go on editing my flow :slight_smile:
but renaming fast-csv worked!! didnt know that the - could cause a problem..
thank you very much