Gitbook安装
切记在执行这个安装命令前,有:
- 设置nodejs的仓库
- 在linux下,请将 加入PATH
在windows下,请务必在windows的 cmd 命令行下执行上述
npm install
命令,不要在linux shell下(比如安装git之后的shell)安装,否则执行gitbook 总是会报错:You need to install "gitbook-cli" to have access to the gitbook command anywhere on your system.
If you've installed this package globally, you need to uninstall it.
通过下列命令安装 grunt 和 grunt-cli
npm install -g grunt grunt-cli
进入任何一本 gitbook 的书籍,执行 gitbook serve
命令,第一次执行时会初始化 GitBook:
sky@skylinux ~/work/code/leaning/leaning-gitbook $ gitbook serve
Installing GitBook 3.2.2
gitbook@3.2.2 ../../../../../../tmp/tmp-109965s9a5ZM8Xffp/node_modules/gitbook
├── escape-html@1.0.3
├── escape-string-regexp@1.0.5
├── destroy@1.0.4
└── npm@3.9.2
Press CTRL+C to quit ...
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
......
Serving book on http://localhost:4000
这个初始化工作只会做一次,之后再运行,哪怕是在其他书籍目录下执行,也不需要再初始化。