我的文件就像avilabele这个结构。如何访问node.js中子文件中的父模块数据
sample.js是根文件和test.js是在XX夹即时拍摄。
sample.js
var name={
h:14
}
module.exports=name;
test.js
var name=require('./sample.js')
console.log(name.h);
当使用运行test.js代码命令提示:
节点test.js
它给错误,如:
找不到模块” ./sample.js'从父目录