云服务器 199 / 年,新老同享,开发者力荐特惠渠道
阿里云推广

node高版本使用gitbook报错解决方案

  • 内容
  • 评论
  • 相关

Node环境:v14.15.1

安装完毕gitbook后执行:gitbook   -V

gitbook  -V

CLI version: 2.3.2

Installing GitBook 3.2.3

C:\Program Files\nodejs\node_global\node_modules\gitbook-cli\node_modules\npm\node_modules\graceful-fs\polyfills.js:287

      if (cb) cb.apply(this, arguments)

                 ^

 

TypeError: cb.apply is not a function

    at C:\Program Files\nodejs\node_global\node_modules\gitbook-cli\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18

at FSReqCallback.oncomplete (fs.js:184:5)

自动安装Installing GitBook 3.2.3等一段时间就报错了。

解决方案:

根据上图文件路径找到这个文件打开,注释掉62,63,64

然后在执行

gitbook  -V

多等一会发现就ok了。

然后执行gitbook   init  发现又报错了。

gitbook init

info: create SUMMARY.md

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Promise

我们找到这个文件\3.2.3\lib\init.js,把72行注释掉增加73行。


               //return fs.writeFile(filePath, summary.toText(extension));

return summary.toText(extension).then(stx=>{return fs.writeFile(filePath, stx);})

本文标签:

版权声明:若无特殊注明,本文皆为《菜鸟站长》原创,转载请保留文章出处。

本文链接:node高版本使用gitbook报错解决方案 - http://www.wlphp.com/?post=369

发表评论

电子邮件地址不会被公开。 必填项已用*标注