Why can't I require express in node.js -


i'm trying simplest node.js script work. here javascript file:

server.js

require("express"); 

i launch script using regulare node command:

$ node server.js 

but error:

node.js:201         throw e; // process.nexttick error, or 'error' event on first tick               ^ error: require.paths removed. use node_modules folders, or node_path environment variable instead.     @ function.<anonymous> (module.js:378:11)     @ object.<anonymous> (/home/shawn/.node_libraries/express@2.5.9/index.js:4:21)     @ module._compile (module.js:441:26)     @ object..js (module.js:459:10)     @ module.load (module.js:348:32)     @ function._load (module.js:308:12)     @ module.require (module.js:354:17)     @ require (module.js:370:17)     @ object.<anonymous> (/home/shawn/documents/projets/passingdata/server.js:3:15)     @ module._compile (module.js:441:26) 

what's going on?

update

interestingly enough, using npm install express outputs similar result:

node.js:201         throw e; // process.nexttick error, or 'error' event on first tick               ^ error: require.paths removed. use node_modules folders, or node_path environment variable instead.     @ function.<anonymous> (module.js:378:11)     @ object.<anonymous> (/home/shawn/.node_libraries/mkdirp@0.3.0/index.js:4:21)     @ module._compile (module.js:441:26)     @ object..js (module.js:459:10)     @ module.load (module.js:348:32)     @ function._load (module.js:308:12)     @ module.require (module.js:354:17)     @ require (module.js:370:17)     @ object.<anonymous> (/usr/lib/nodejs/fstream/lib/dir-reader.js:11:13)     @ module._compile (module.js:441:26) 

you need install globally (if don't build package)

npm install express -g 

or if have in package.json have local install npm install -l , work fine.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - EclipseLink JPA Object is not a known entity type -

java - Need to add SOAP security token -