// 当前js文件路径为D:/pathDemo/app.jsconst path =require('path')// 1.直接拼接路径
console.log(path.join(__dirname,'a','b','demo.js'));//输出: D:\pathDemo\a\b\demo.js// 2.路劲开头的 / 不会影响拼接, 两个点 .. 代表上一级目录
console.log(path.join(__dirname,'/a','./b','../'));//输出: D:\pathDemo\a\// 3.path.join()会做路径字符串的校验,不合法时会报错
path.join(__dirname,'a',{})//The "path" argument must be of type string. Received an instance of Object