1.下载Nodejs并安装,默认路径即可。(用最新的版本没成功,按照一篇博客里提示的版本nodejs v10.23.0,成功创建gitbook)
https://nodejs.org/download/release/v10.23.0/node-v10.23.0-x64.msi
2.命令行查看一下版本
如果npm版本不对就安装一下:npm -g install [email protected]
3.安装gitbook-cli:npm install -g gitbook-cli
C:\Users\zhang>npm install -g gitbook-cli C:\Users\zhang\AppData\Roaming\npm\gitbook -> C:\Users\zhang\AppData\Roaming\npm\node_modules\gitbook-cli\bin\gitbook.js + [email protected] added 105 packages from 71 contributors, removed 629 packages and updated 25 packages in 32.979s
4.创建一本gitbook
C:\Users\zhang>d: D:\>mkdir gitbook D:\>cd gitbook D:\gitbook>mkdir firstbook D:\gitbook>cd firstbook D:\gitbook\firstbook>gitbook init Installing GitBook 3.2.3 (node:15092) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit (node:15092) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit [email protected] C:\Users\ZHANGJ~1\AppData\Local\Temp\tmp-15092fYD26BQCpSWV\node_modules\gitbook ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) └── [email protected] ([email protected], [email protected], [email protected]) info: create README.md info: create SUMMARY.md info: initialization is finished
gitbook init执行成功会产生两个文件,目录:SUMMARY.md,第一篇文章:README.md
# Summary -- 这个是标题 * [Introduction](README.md) -- 这个是引用README.md,相当于建立一个超级链接,中括号里的是一个提示内容,可自定义。
5.启动server:
D:\gitbook\firstbook>gitbook serve Live reload server started on port: 35729 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 2 pages info: found 0 asset files info: >> generation finished with success in 0.7s ! Starting server ... Serving book on http://localhost:4000
6.在浏览器里访问:
7._book目录可以直接拷贝到nginx目录或者放到github里访问,相当于生成了一个静态站点。
参考:
1.https://blog.csdn.net/weixin_50920579/article/details/123179462
2.https://blog.csdn.net/weixin_50920579/article/details/123161481
3.https://baijiahao.baidu.com/s?id=1721076634433156540&wfr=spider&for=pc
4.https://apioak.com/zh_CN/basic-information/gitbook-local-building.html
标签:info,...,loading,OK,nodejs,plugin,Windows10,gitbook From: https://www.cnblogs.com/v5captain/p/16966684.html