Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何要求一个模块是另一个模块的依赖项?例如:
Project/foo.js Project/nodule_modules/MyModule/node_modules/AnotherModule //dependencie of MyModule
如何从 foo.js 文件中要求“AnotherModule”?
在foo.js模块中使用:
foo.js
var that = require('./node_modules/MyModule/node_modules/AnotherModule');
见http://nodejs.org/api/modules.html#modules_file_modules