I'm trying to get the simplest node.js script to work. Here is the javascript file:
server.js
require("express");
I launch the script using the regulare node command:
$ node server.js
But I get an error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.<anonymous> (module.js:378:11)
at Object.<anonymous> (/home/shawn/.node_libraries/express@2.5.9/index.js:4:21)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/home/shawn/Documents/Projets/passingData/server.js:3:15)
at Module._compile (module.js:441:26)
What's going on?
UPDATE
Interestingly enough, using npm install express
outputs a similar result:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.<anonymous> (module.js:378:11)
at Object.<anonymous> (/home/shawn/.node_libraries/mkdirp@0.3.0/index.js:4:21)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/usr/lib/nodejs/fstream/lib/dir-reader.js:11:13)
at Module._compile (module.js:441:26)
you need to install it globally like this (if you don't build it as package)
npm install express -g
or if you have it in package.json
you have to do local install npm install -l
and it will work fine.