Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run dev 启动时报错 #40

Open
qyingkou opened this issue Dec 31, 2020 · 2 comments
Open

npm run dev 启动时报错 #40

qyingkou opened this issue Dec 31, 2020 · 2 comments

Comments

@qyingkou
Copy link
Contributor

qyingkou commented Dec 31, 2020

如题进行到“Installing Gitbook 3.2.3”步骤时报错如下:

TypeError: cb.apply is not a function

在gitbook-cli官方仓库的issue中找到问题:#110
意思是说gitbook-cli依赖的是低版本的graceful-fs只支持nodejs 12-,而事实上高版本的graceful-fs是支持nodejs 13+的

所以动手解决,记录如下:
解决办法1:降级nodejs为v12 (不采用)
解决办法2:升级graceful-fs包到最高版本(采用)

// 需要安装gitbook-cli(全局或者项目)
npm i gitbook-cli -g

// 找到刚才安装的gitbook-cli包的安装位置,升级```graceful-fs```
cd <gitbook-cli DIR> /node_modules/npm/node_modules
npm install graceful-fs@latest --save

// 安装Gitbook 3.2.3
gitbook -V

// 找到用户根目录下的.gitbook文件夹,升级```graceful-fs```
cd <.gitbook DIR> /versions/3.2.3/node_modules/npm
npm install graceful-fs@latest --save

可以启动工程了

proj_root> npm i // 安装依赖
proj_root> npm run dev // 成功

最后想问,就我一人在用nodejs v14?

@donaf
Copy link
Contributor

donaf commented Jan 7, 2021

我也在用

@Rush-YL
Copy link

Rush-YL commented Jul 28, 2021

mac/linux 下用nvm,win10用nvs,管理node版本随时切换,就可以解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants