所以我有一些 node.js 文件
/folder/app.js
/folder/node_modules/moduleIwanttoload
/folder/subfolder/file.js
我如何从 file.js 请求 moduleIwanttoload
?
最佳答案
你可以在 app.js 中使用像这样的子文件夹文件
var file = require('./subfolder/file.js');
在 Node 模块的文件夹中,你可以像这样使用它
var moduleIwanttoload = require("moduleIwanttoload");
关于node.js - 需要子文件夹中的 node_module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24854554/