fs.js:133
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at maybeCallback (fs.js:133:9)
at Object.writeFile (fs.js:1139:14)
at /Users/jinzhenguo/Documents/developer/sliders/build.js:60:14
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sliders@0.1.0 build: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sliders@0.1.0 build script.
解決辦法:
node 版本問題,node v10 以上 fs.write 的callback 是必須的。
如果不想重新安裝node到低版本
將webpack.dev.config.js 和 webpack.prod.config.js 中的代碼修改即可:
// 具體里面的參數(shù)參考node v10 的文檔凫海,或者直接刪除可選的參數(shù)
fs.write(fd, buf, function(err, written, buffer) {});