Node.js 读取带有节点js的文件时出错
我无法读取在internet上找到的带有此代码的文件Node.js 读取带有节点js的文件时出错,node.js,file,compiler-errors,readfile,Node.js,File,Compiler Errors,Readfile,我无法读取在internet上找到的带有此代码的文件 var express=require('express'); var-app=express(); var fs=需要('fs'); var端口=8080; app.get('/',函数(req,res){ fs.readFile('./querys/anagconti\u clienti\u giorni.txt',utf8',函数(err,data){ 如果(错误){ res.send(err); }否则{ res.send(数据);
var express=require('express');
var-app=express();
var fs=需要('fs');
var端口=8080;
app.get('/',函数(req,res){
fs.readFile('./querys/anagconti\u clienti\u giorni.txt',utf8',函数(err,data){
如果(错误){
res.send(err);
}否则{
res.send(数据);
}
});
});
var server=app.listen(端口,函数(){
console.log(“启动于http://localhost:“+港口);
});
它给我的错误是:
{“错误号”:-4058,
“代码”:“enoint”,
“系统调用”:“打开”,
“路径”:“C:\Users\AlessandroGolin\Desktop\Mia\Visual\u Studio\server\u link\querys\anagconti\u clienti\u giorni.txt
“}
导致此错误的原因是什么?请交叉检查“/querys/anagconti\u clienti\u giorni.txt”文件的路径或权限。如果文件不存在,则在上述代码文件所在的同一级别创建“查询”文件夹。好的,谢谢您的建议:)事实上,我意识到插入的目录是错误的!