npm安装async模块

nodejs安装async后提示找不到module
1.首先在项目文件夹下通过命令安装async:npm install async -g
2.js里使用var async = require('async'); 报错:
can not found module 'async'

------------------------------在网上查了一下
A global installation of an NPM doesn't always mean that the module can be shared for multiple projects. This is a pretty popular misconception. You can read this blog post on nodejs.org for more information, but generally speaking, global modules are used for command line tools and other system utilities, not for modules to be used in your code.

So, ideally, you would need the modules locally for each of your projects.

所以把全局参数-g去掉,就没问题了

猜你喜欢

转载自yilianxinyuan.iteye.com/blog/2373577