OpenMarine
Pi refuses connection for Node Red and Dahboard - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=2)
+--- Thread: Pi refuses connection for Node Red and Dahboard (/showthread.php?tid=634)



Pi refuses connection for Node Red and Dahboard - JD1 - 2017-07-14

I am not sure if I somehow managed to screw something up or not but I am starting to sweat a bit ....
I can reboot my pi, I can get into it via VNC, I can see the SignalK diagnostic page. I can go to all the OpenPlotter tabs and things 'seem' to work right. If I go to the signalK tab and click on 'show signal k tools', I get the expected web page but the tab 'Node Red' tells me the server is refusing connection, the Dashboard gives me a blank page and freeboard gives me a refused connection error as well.
The other thing I noticed is that on reboot, a 'tool' I added to the 'Tools' menu doesn't start automatically (BMV700 battery monitor code) but runs fine if I start it manually.
I did have a situation where, when Node Red still ran, it reported a discrepancy with the node red flows between a remote browser and the local page (???) and it asked me if I wanted to merge the two. I never answered the question and eventually rebooted and Node Red did not come back up.

Any ideas ?

Ok, figured out how to start NodeRed manually and I get this:

pi@openplotter:~ $ node-red
Error loading settings file: /home/pi/.node-red/settings.js
/home/pi/.node-red/settings.js:178
functionGlobalContext: {
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/node-red/red.js:115:20)
pi@openplotter:~ $ ^C

I think this is the section of settings.js that it objects to:

// Anything in this hash is globally available to all functions.
// It is accessed as context.global.
// eg:
// functionGlobalContext: { os:require('os') }
// can be accessed in a function block as:
// context.global.os

functionGlobalContext: {
// os:require('os'),
// octalbonescript:require('octalbonescript'),
// jfive:require("johnny-five"),
// j5board:require("johnny-five").Board({repl:false})
},

I have no clue why .....


RE: Pi refuses connection for Node Red and Dahboard - JD1 - 2017-07-14

Ok, so I screwed up ....

The settings.js file contains this section
// Node-RED scans the `nodes` directory in the install directory to find nodes.
// The following property can be used to specify an additional directory to scan.
//nodesDir: '/home/nol/.node-red/nodes',

So I added

nodesDir: '/home/pi/.node-red/add.nodes'

and somehow that screwed everything up ..... could be because there is no ',' at the end of the line I added.
Why the heck it screwed up where it did, I have no clue (yeah, I know, common theme with me)

I thought I had rebooted after the original change but obviously I did not. When I had unrelated issues and rebooted the pi, this gem decided to rear it's ugly head Sad
The line was removed and all is well again