当前位置:   article > 正文

fs.js ERR_INVALID_CALLBACK();_fs.js:145 throw new err_invalid_callback(cb)

fs.js:145 throw new err_invalid_callback(cb)
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:1179:14)
    at Function.BookGen.processFiles (/Users/jiaolong/workspace/distsysbook/bookgen/generate.js:75:6)
    at /Users/jiaolong/workspace/distsysbook/bookgen/generate.js:19:15
    at FSReqCallback.args [as oncomplete] (fs.js:145:20)
make: *** [build] Error 1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

这个问题是由于node版本引起的,可以通过如下方式进行修复

// fs.write(fd, buf, 0, buf.length, 0, function(err, written, buffer) {}); // node --version < v10.1.0
fs.write(fd, buf, function(err, written, buffer) {}); // node --version > v10.1.0
  • 1
  • 2

参考文档

项目克隆下来后npm install 完成后无法运行 #655

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/198121
推荐阅读
相关标签
  

闽ICP备14008679号