Today, I get strange thing that after i install async in global, nodejs reports it can not find the module.following is the workflow
install async
npm install -g async
make sure async exists
npm list -g async
get this output:
/usr/local/lib ├── [email protected] └─┬ [email protected] └─┬ [email protected] └─┬ [email protected] └── [email protected]
3.try to use it.
I create a simple js file which only contains one statement: var async=require('async'); then execute the file via node, I get exception:
Error: Cannot find module 'async' 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. (/lxzhu/nodejs/asynctest/test.js:1:73) 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)