PHP菜鸟博客_共同学习分享PHP技术心得【PHP爱好者】
node高版本使用gitbook报错解决方案
2022-8-25 菜鸟站长


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);})

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容