gitbook使用踩坑日記
在使用gitbook init命令時引發的一系列問題記錄
坑
gitbook init cb不是函數問題
$ gitbook init
Installing GitBook 3.2.3
C:\Users\14251\AppData\Roaming\npm\node_modules\gitbook-cli\node_modules\npm\node_modules\graceful-fs\polyfills.js:287
if (cb) cb.apply(this, arguments)
^
TypeError: cb.apply is not a function
at C:\Users\14251\AppData\Roaming\npm\node_modules\gitbook-cli\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
at FSReqCallback.oncomplete (fs.js:184:5)
版本不兼容需要將node版本降級
nvm use時 exit status 1
在控制台下因為編碼問題顯示了亂碼 改用git bash控制台來查看了之后發現是權限不足
常見兩類錯誤導致exit status 1:
- 安裝路徑中含有中文和空格
- 在使用啟動權限不足
解決方法
cb不是函數問題
使用10.23.1版本的node
exit status 1
- 重新安裝更改路徑
- 用管理員權限打開cmd
NVM命令
nvm install 10.23.1
:安裝node
nvm use 10.23.1
:使用node(要在管理員權限下使用)
nvm ls
:查看當前安裝
nvm ls available
:查看所有可使用版本
nvm -v
:查看當前版本
# nvm 鏡像下載文件
在nvm安裝目錄settings.txt下加入:
node_mirror: http://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/