Environment: Ubuntu 12.04 32bit, Kernel 3.2.0-40, Python 2.7.3, node 0.10.10
Installed (as root) node src vie wget into /usr/local/src ->./configure,
make, make install
switched to normal user 'max' and created hello.js in
/home/max/nodeProjects.
node hello.js works fine
Added postgres module:
(as root)
cd /usr/local/src
npm install pg
no complaints.
added (as normal user) this line to hello.js:
var pg = require('pg');
max@leonardo:~/nodeProjects$ node test.js
module.js:340
throw err;
^
Error: Cannot find module 'pg'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/max/nodeProjects/test.js:2:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
This superb documentation
http://nodejs.org/docs/v0.10.10/api/modules.html#loading_from_node_modules_Folders
teached me about the search path order, so I tried a *dirty workaround:*
cd /usr/local/src
cp -R node_modules /home/max
cd /home/max
chown -R max:max node_modules
And as max
mv node_modules .node_modules
Uupsi!! It worked.
But, sincerely, folks: this is ugly, this could not be the default way of
getting the fish to swim ...
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.