Node.js 如何解决文件系统中的抛出错误

Node.js 如何解决文件系统中的抛出错误,node.js,filesystems,Node.js,Filesystems,我正在启动node并希望写入文件,但当我运行应用程序时,出现了错误 财政司司长: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 Ibra

我正在启动node并希望写入文件,但当我运行应用程序时,出现了错误 财政司司长: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')
var fs = require('fs')
fs.writeFileSync('./note.txt','this notes was created by node')