教育兼职网站开发,做网站服务器硬盘多大,企业画册模板,银川做网站推广最近想重新搭建一个网站来存放自己的相关知识点#xff0c;并向网络公开#xff0c;有个hexo博客其实也不错的#xff0c;但是总感觉hexo很多花里胡哨的玩意#xff0c;导致挂载的博客异常卡#xff0c;这样反而不利于我自己回顾博客了#xff0c;于是我就开始钻研这个鬼…最近想重新搭建一个网站来存放自己的相关知识点并向网络公开有个hexo博客其实也不错的但是总感觉hexo很多花里胡哨的玩意导致挂载的博客异常卡这样反而不利于我自己回顾博客了于是我就开始钻研这个鬼东西了从安装到搭建也费力我一段时间主要是不知道版本依赖导致失败次数比较多属于踩坑了。 废话不多说了开始走起。
安装nodejs
这个不多说了网上找资源一找一大片学习Vue的脚手架的时候这个玩意估计大家都玩过了安装的时候一直next就行了。 这个是代表安装成功了我的版本是V16左右建议你也选择16左右的不然自己一个一个找版本很烦人的。
安装gitbook
1.通过指令安装
我们在安装nodejs之后打开控制台输入这个是最新版的
npm install gitbook-cli -g安装指定版本的
npm install gitbook-cli2.1.2安装gitbook
2.检查是否安装成功
gitbook -V注意这一步主要是为了查看我们是否安装gitbook的依赖版本。
3.查看可以安装的版本
查看可以安装的版本
gitbook ls-remote4.安装指定版本
注意我的是nodejs 16 安装的版本是 3.2.23.2.3这两个版本最佳注意这一步安装很慢很慢需要等待很久我至少半个小时以上。 安装指定版本
gitbook fetch 3.2.3日志如下
$ gitbook fetch 3.2.3
Installing GitBook 3.2.3
gitbook3.2.3 C:\Users\29283\AppData\Local\Temp\tmp-4331226wiW7x357C7\node_modules\gitbook
├── escape-string-regexp1.0.5
├── escape-html1.0.3
├── destroy1.0.4
├── ignore3.1.2
├── bash-color0.0.4
├── gitbook-plugin-livereload0.0.1
├── cp0.2.0
├── nunjucks-do1.0.0
├── graceful-fs4.1.4
├── github-slugid1.0.1
├── q1.4.1
├── spawn-cmd0.0.2
├── gitbook-plugin-fontsettings2.0.0
├── is3.3.0
├── open0.0.5
├── direction0.1.5
├── object-path0.9.2
├── extend3.0.2
├── json-schema-defaults0.1.1
├── gitbook-plugin-search2.2.1
├── jsonschema1.1.0
├── crc3.4.0
├── urijs1.18.0
├── semver5.1.0
├── immutable3.8.2
├── front-matter2.3.0
├── npmi2.0.1 (semver4.3.6)
├── resolve1.1.7
├── gitbook-plugin-theme-default1.0.7
├── moment2.13.0
├── gitbook-plugin-sharing1.0.2 (lodash3.10.1)
├── i18n-t1.0.1 (lodash4.17.21)
├── npm3.9.2
├── dom-serializer0.1.0 (domelementtype1.1.3, entities1.1.2)
├── omit-keys0.1.0 (isobject0.2.0, array-difference0.0.1)
├── error7.0.2 (xtend4.0.2, string-template0.2.1)
├── tmp0.0.28 (os-tmpdir1.0.2)
├── mkdirp0.5.1 (minimist0.0.8)
├── gitbook-plugin-lunr1.2.0 (html-entities1.2.0, lunr0.5.12)
├── gitbook-plugin-highlight2.0.2 (highlight.js9.2.0)
├── gitbook-markdown1.3.2 (kramed-text-renderer0.2.1, gitbook-html1.3.3, kramed0.5.6, lodash4.17.21)
├── send0.13.2 (range-parser1.0.3, fresh0.3.0, statuses1.2.1, etag1.7.0, ms0.7.1, depd1.1.2, debug2.2.0, mime1.3.4, http-errors1.3.1, on-finished2.3.0)
├── gitbook-asciidoc1.2.2 (gitbook-html1.3.3, lodash4.17.21, asciidoctor.js1.5.5-1)
├── js-yaml3.14.1 (esprima4.0.1, argparse1.0.10)
├── rmdir1.2.0 (node.flow1.2.3)
├── fresh-require1.0.3 (is-require0.0.1, shallow-copy0.0.1, astw1.3.0, acorn0.9.0, sleuth0.1.1, through20.6.5, escodegen1.14.3)
├── cheerio0.20.0 (entities1.1.2, lodash4.17.21, htmlparser23.8.3, css-select1.2.0, jsdom7.2.2)
├── tiny-lr0.2.1 (parseurl1.3.3, livereload-js2.4.0, qs5.1.0, debug2.2.0, faye-websocket0.10.0, body-parser1.14.2)
├── cpr1.1.1 (rimraf2.4.5)
├── request2.72.0 (aws-sign20.6.0, tunnel-agent0.4.3, forever-agent0.6.1, oauth-sign0.8.2, is-typedarray1.0.0, caseless0.11.0, stringstream0.0.6, aws41.12.0, isstream0.1.2, json-stringify-safe5.0.1, tough-cookie2.2.2, qs6.1.2, node-uuid1.4.8, combined-stream1.0.8, mime-types2.1.35, hawk3.1.3, form-data1.0.1, bl1.1.2, http-signature1.1.1, har-validator2.0.6)
├── read-installed4.0.3 (debuglog1.0.1, util-extend1.0.3, slide1.1.6, readdir-scoped-modules1.1.0, read-package-json2.1.2)
├── juice2.0.0 (deep-extend0.4.2, slick1.12.2, batch0.5.3, cssom0.3.1, commander2.9.0, cross-spawn-async2.2.5, web-resource-inliner2.0.0)
├── chokidar1.5.0 (path-is-absolute1.0.1, async-each1.0.6, inherits2.0.4, glob-parent2.0.0, is-glob2.0.1, is-binary-path1.0.1, anymatch1.3.2, readdirp2.2.1)
└── nunjucks2.5.2 (asap2.0.6, yargs3.32.0, chokidar1.7.0)
5.查看安装的gitbook版本
gitbook ls日志如下
$ gitbook ls
GitBook Versions Installed:* 3.2.3
Run gitbook update to update to the latest version.
6.初始化文件注意这一步有个大坑很大的坑
gitbook init不出意外你会碰到一个这样的错误。跟着我来咱们解决这个问题。
$ gitbook init
warn: no summary file in this book
info: create README.md
info: create SUMMARY.mdTypeError [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这个问题需要我们修改js文件也就是C:\Users\29283\.gitbook\versions\3.2.3\lib下的init.js文件.
替换的代码
return summary.toText(extension).then(stx{return fs.writeFile(filePath, stx);})OK我们再次执行相关代码
gitbook init如下代表成功了可以开始写文档了。
$ gitbook init
warn: no summary file in this book
info: create SUMMARY.md
info: initialization is finished