[英]Node.js require is not loading local file
var typeOfUser = require('../js/type.js');
var typeOfUser = require('./js/type.js');
var typeOfUser = require('./type.js');
None of the above lines (written within a file named dashboardJS.js
situated in folder named js
) are working. 以上所有行(写在名为
js
文件夹中的名为dashboardJS.js
的文件中)均无效。 require
here is not working. require
这里不起作用。 The folder structure is: 文件夹结构为:
Project_on_dairy/MDMS/js/type.js
Project_on_dairy/MDMS/js/dashboardJS.js
Maybe it will works if you try with something like this ? 如果您尝试使用这种方法,也许会奏效?
var typeOfUser=require(__dirname + '/MDMS/js/type.js');
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.