Gateway installation question - gateway.js

Started by jonedw, May 21, 2016, 11:37:14 PM

jonedw

I am in the process of working on a fresh installation of the gateway but I have hit a brick wall on a issue when I try to start gateway.JS.  The following error appears that seems to point out that gateway.db can not be opened:

pi@raspberrypi:~/gateway $ node gateway.js &
[1] 1665
pi@raspberrypi:~/gateway $ /home/pi/gateway/node_modules/nedb/lib/datastore.js:77
    if (err) { throw err; }
                     ^
Error: ENOENT, open '/home/pi/gateway/data/db/gateway.db'
    at Error (native)

[1]+  Exit 1                  node gateway.js

Any clues what I may have missed during my setup?

Scram

May be a access rights problem on file '/home/pi/gateway/data/db/gateway.db' !?

Mine has :
rights: rw-r--r--
user: pi

jonedw

gateway.db does not exist.  It looks like the gateway.js script is not creating the db. 

The sub folder /gateway/data permissions look correct:

drwxr-xr-x 2 root root 4096 May 20 21:05 db
drwxr-xr-x 2 root root 4096 May 20 18:55 secure



Felix

ENOENT means it can't find the db file.
If you look at the nedb docs, the way the constructor is built is to create the file the first time it is written to. Here's the line in gateway.js:

var db = new Datastore({ filename: path.join(__dirname, dbDir, settings.database.name.value), autoload: true });       //used to keep all node/metric data

jonedw

Felix, I do see that line in gateway.js and as far as I can see it should be creating the gateway.db file. 

I know it is a stretch, but do you have any idea what I may have missed in the setup that would prevent the creation of the gateway.db by the script? 

I have reviewed the steps in the setup instructions multiple times and I can not see what I have missed.

Felix

Not sure what you missed, but if you do a manual install make sure you have the latest code from the master branch.
I just pasted that code directly from github so maybe you have stale code.