的文檔fs.readFileSync
是節點READFILE路徑必須是一個字符串
file <String> | <Buffer> | <Integer> filename or file descriptor
但
require('fs').readFile(0);
導致給定一個( 「整數」)文件描述符,如何錯誤
TypeError: path must be a string
at TypeError (native)
at Object.fs.readFile (fs.js:250:11)
at repl:1:15
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:211:10)
我讀過它嗎?
可能是相關的:https://github.com/nodejs/node/issues/5862 –