0

I recently install nodejs in linux. and write a simple code:

var http = require('http');
var sleep = require('sleep');
...

i install sleep with this command:
sudo npm install -g sleep
But, when i run the program with:
nodejs test.js
I get this error:

Error: Cannot find module 'sleep'
    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/mlibre/tmp/test/nodejs/test.js:2:13)
    ...

informations

node -v
v6.6.0

npm -v
3.10.3   

npm -g ls | grep sleep
└─┬ sleep@4.0.0
mlibre
  • 2,460
  • 3
  • 23
  • 32

0 Answers0