Windows10 gitbook本地搭建(nodejs v10.23.0)

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 npm@6.14.8

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
+ gitbook-cli@2.3.2
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
gitbook@3.2.3 C:\Users\ZHANGJ~1\AppData\Local\Temp\tmp-15092fYD26BQCpSWV\node_modules\gitbook
├── escape-string-regexp@1.0.5
├── escape-html@1.0.3
├── destroy@1.0.4
├── chokidar@1.5.0 (async-each@1.0.3, path-is-absolute@1.0.1, inherits@2.0.4, glob-parent@2.0.0, is-glob@2.0.1, is-binary-path@1.0.1, anymatch@1.3.2, readdirp@2.2.1)
└── nunjucks@2.5.2 (asap@2.0.6, yargs@3.32.0, chokidar@1.7.0)
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

posted @   船长博客  阅读(605)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 2 本地部署DeepSeek模型构建本地知识库+联网搜索详细步骤
历史上的今天:
2020-12-08 Ubuntu PostgreSQL数据库忘记密码
每个人都有一个觉醒期,但觉醒的早晚决定个人的命运
点击右上角即可分享
微信分享提示