rurseekatze / node-tileserver

A lightweight tileserver based on NodeJS for serving bitmap and vector tiles.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

it cannot find module pg

zairiedu opened this issue · comments

it's installed under node_module, and it cannot recognize it !!

node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'pg'
at Function._resolveFilename (module.js:289:11)
at Function._load (module.js:241:25)
at require (module.js:317:19)
at Object. (/home/yasser/Desktop/nodetileserver/node-tileserver/tileserver.js:17:6)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)
at Array. (module.js:392:10)
at EventEmitter._tickCallback (node.js:108:26)

Is the node_module directory in the same folder as the tileserver.js?

Ensure this by trying:

cd /home/yasser/Desktop/nodetileserver/node-tileserver
npm install pg

You should also install all other necessary modules in this directory, otherwise it won't work.

See also http://stackoverflow.com/questions/18970451/node-js-and-node-postgres-syntax-error

it's in the same directory yes.
by the way adding a package.json file would be a nice thing i guess.
otherwise i don't see why it doesn't take it.

yasser@yasser-300E4A-300E5A-300E7A-3430EA-3530EA:~/Desktop/nodetileserver/node-tileserver/node_modules$ ls

assert byline canvas cluster events graceful-fs http http-proxy log4js mkdirp pg rbush toobusy touch url

when i delete the require('pg') since i cannot find it used anywhere it gives me another error:
yasser@yasser-300E4A-300E5A-300E7A-3430EA-3530EA:~/Desktop/nodetileserver/node-tileserver$ node tileserver.js

node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Module version mismatch, refusing to load.
at Object..node (module.js:385:11)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)
at require (module.js:317:19)
at bindings (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/toobusy/node_modules/bindings/bindings.js:76:44)
at Object. (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/toobusy/index.js:1:96)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)

Don't edit the code! The pg-module is necessary for requesting the database. Without this module the program will not work properly and you will get unexpected errors.

I have no idea why it is still not working. I could imagine that there are either some permission problems or a version incompatibility. I am using version 2.8.3 on my productive system, this version definitely works.

A package.json file will come soon.

thank you very much indeed,
i'll try this version and i'll let you know later
thank you again

i reinstalled node from chris lea repository : ppa:chris-lea/node.js. the one from the official website seem to have some issues.
then i reinstalled node_gyp.
and it worked like a charm :)

Perfect! 👍