TypeError: Cannot read property 'toString' of undefined

背景 博主在測試 Node.js 的異步操作時,如果直接在 ~ 目錄下使用 node 命令運行文件,就會報 TypeError: Cannot read property ‘toString’ of undefined 的錯誤,但如果是先進入到文件所在的目錄下,再使用 node 命令運行文件就是正常的,原因在下面解釋 代碼 var fs = require("fs"); fs.readFile(
相關文章
相關標籤/搜索