MacOS install GitBook 未成功经验
安装GitBook遇到的各种问题
- 环境信息
Node.js v14.17.1 |
- 安装遇到的问题
npm install gitbook-cli -g |
出现异常:
1 | Installing GitBook 3.2.3 |
修复问题:
#cli pkg noxexits |
异常日志:
Installing GitBook 3.2.3 |
修复:
$ cd /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/ |
参考:
gitbook-cli-install-error-typeerror-cb-apply-is-not-a-function-inside-graceful
- 启动服务异常
# 启动 |
还是遇到异常:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43Live reload server started on port: 13244
Press CTRL+C to quit ...
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
internal/streams/readable.js:630
if (state.pipes.length === 1) {
^
TypeError: Cannot read property 'pipes' of undefined
at ReadStream.Readable.pipe (internal/streams/readable.js:630:13)
at /Users/ordiy/.gitbook/versions/3.2.3/node_modules/cpr/lib/index.js:163:22
at callback (/usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:299:20)
at FSReqCallback.oncomplete (fs.js:192:21)
➜ isun-blog-book git:(master) ✗ gitbook serve --lrport 13244 --port 4002 book-blog
➜ isun-blog-book git:(master) ✗ npm install cpr
npm WARN saveError ENOENT: no such file or directory, open '/opt/ordiy/px03-private-project/isun-blog-book/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/opt/ordiy/px03-private-project/isun-blog-book/package.json'
npm WARN isun-blog-book No description
npm WARN isun-blog-book No repository field.
npm WARN isun-blog-book No README data
npm WARN isun-blog-book No license field.
+ cpr@3.0.1
added 16 packages from 15 contributors and audited 16 packages in 4.371s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
╭────────────────────────────────────────────────────────────────╮
│ │
│ New major version of npm available! 6.14.13 → 7.19.0 │
│ Changelog: https://github.com/npm/cli/releases/tag/v7.19.0 │
│ Run npm install -g npm to update! │
│ │
╰────────────────────────────────────────────────────────────────╯
吼吼…. 的node.js 小白水平,仔细看看应该是node.js版本问题
#当前机器的node js版本是17,版本太高,使用nvm切换版本 |
问题解决~~~
总结
出现失败的问题可能是 gitbook 依赖的组件版本有问题,导致执行出现问题,在尝试了多次为能找到问题,选择使用honkitz作为替代方案