Error: require.paths deleted. Use the node_modules folders or instead of the NODE_PATH environment variable

I just installed Node.js recently and now I am trying to run a simple script, but I am getting the following error message:

Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead. at Function.<anonymous> (module.js:383:11) at Object.<anonymous> (/home/shawn/.node_libraries/ express@2.5.9 /index.js:4:21) at Module._compile (module.js:446:26) at Object..js (module.js:464:10) at Module.load (module.js:353:31) at Function._load (module.js:311:12) at Module.require (module.js:359:17) at require (module.js:375:17) at Object.<anonymous> (/home/shawn/Documents/Projets/jsonpExchange/server.js:1:77) at Module._compile (module.js:446:26) 

What does this mean and how can I solve it?

UPDATE:

 $ node -v v0.6.19 $ npm install express npm http GET https://registry.npmjs.org/express npm http 304 https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/mkdirp/0.3.0 npm http GET https://registry.npmjs.org/qs npm http GET https://registry.npmjs.org/connect npm http GET https://registry.npmjs.org/mime/1.2.4 npm http 304 https://registry.npmjs.org/mkdirp/0.3.0 npm http 304 https://registry.npmjs.org/connect npm http 304 https://registry.npmjs.org/qs npm http 304 https://registry.npmjs.org/mime/1.2.4 npm http GET https://registry.npmjs.org/formidable npm http 304 https://registry.npmjs.org/formidable express@2.5.10 ./node_modules/express ├── qs@0.4.2 ├── mime@1.2.4 ├── mkdirp@0.3.0 └── connect@1.9.0 ( formidable@1.0.11 ) 
+7
source share
2 answers

This error occurs when some installed packages are created for an older version of nodejs.

What version of node are you using?

 $ node -v 

Do you use npm (http://npmjs.org) to install packages? The result of installing express should look like this:

 $ npm install express npm http GET https://registry.npmjs.org/express npm http 200 https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/mime/1.2.4 npm http GET https://registry.npmjs.org/mkdirp/0.3.0 npm http GET https://registry.npmjs.org/qs npm http GET https://registry.npmjs.org/connect npm http 304 https://registry.npmjs.org/mime/1.2.4 npm http 304 https://registry.npmjs.org/mkdirp/0.3.0 npm http 304 https://registry.npmjs.org/qs npm http 200 https://registry.npmjs.org/connect npm http GET https://registry.npmjs.org/connect/-/connect-1.9.0.tgz npm http 200 https://registry.npmjs.org/connect/-/connect-1.9.0.tgz npm http GET https://registry.npmjs.org/formidable npm http 304 https://registry.npmjs.org/formidable express@2.5.10 ./node_modules/express ├── qs@0.4.2 ├── mkdirp@0.3.0 ├── mime@1.2.4 └── connect@1.9.0 ( formidable@1.0.11 ) 
+4
source

In my case, I have an old local (user) installation of coffee-script .

Here is what I did:

  • deleted the ~/.node_modules
  • deleted corresponding binaries in ~/bin
  • reinstall coffee-script : sudo npm install --global coffee-script

Now it works :)

0
source