danburzo / every-street

Drawing every street in Romania using OpenStreetMap data, Node.js and SVG
http://danburzo.ro/every-street
MIT License
78 stars 9 forks source link

undefined db in callback #8

Closed luke-j closed 8 years ago

luke-j commented 8 years ago

The command nodejs tools/load-nodes.js returns this error:

/home/every-street-master/node_modules/level-writestream/index.js:5
  db.createWriteStream = createWriteStream;
                       ^
TypeError: Cannot set property 'createWriteStream' of undefined
    at attachConstructor (/home/every-street-master/node_modules/level-writestream/index.js:5:24)
    at /home/every-street-master/tools/load-nodes.js:15:2
    at dispatchError (/home/every-street-master/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/util.js:64:35)
    at /home/every-street-master/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/levelup.js:119:14
    at /home/every-street-master/node_modules/level/node_modules/leveldown/node_modules/abstract-leveldown/abstract-leveldown.js:39:16

If I console.log(db) right here I get undefined. So the whole levelup callback receives undefined for the database instance.

Any clues as to the cause of this?

danburzo commented 8 years ago

Hi Luke, I've just added error logging for opening the LevelDB connection: https://github.com/danburzo/every-street/commit/418fe52f87ac06b4e1067360bf154ef7f040984c That should give us a clue as to what's going on.

luke-j commented 8 years ago

The console prints an empty object, {}, for the err argument and returns. However, the LOG file within the everystreet directory contains:

MANIFEST write: IO error: everystreet: Invalid argument

That error lead me to this issue with levelup, regarding the database being within a synced vagrant folder. Simply moving the folder to another location on the vagrant machine solved the issue.

Thanks for the help!

danburzo commented 8 years ago

Ah, I see! :+1: