Jim*_*nes 8 node.js node-modules
所以我有一些node.js文件
/folder/app.js
/folder/node_modules/moduleIwanttoload
/folder/subfolder/file.js
Run Code Online (Sandbox Code Playgroud)
我如何moduleIwanttoload从file.js 要求?
你可以在 app.js 中使用这样的子文件夹文件
var file = require('./subfolder/file.js');
Run Code Online (Sandbox Code Playgroud)
在 node-modules 文件夹中,您可以像这样使用它
var moduleIwanttoload = require("moduleIwanttoload");
Run Code Online (Sandbox Code Playgroud)