我正在启动节点并想写入文件,但是当我运行应用程序时出现错误 fs.js:125 犯错 ^
Error: ENOENT: no such file or directory, open 'note.txt'
at Object.openSync (fs.js:454:3)
at Object.writeFileSync (fs.js:1247:35)
at Object.<anonymous> (C:\Users\Dawood Ibrar\Desktop\Node\notes-
app\app.js:3:4)
我的代码受保护
var fs = require('fs')
fs.writeFileSync('note.txt','this notes was created by node')
答案 0 :(得分:1)
尝试一下
var fs = require('fs')
fs.writeFileSync('./note.txt','this notes was created by node')