踩坑日记——macos安装gitbook出错

出错地方:

npm install gitbook-cli -g
gitbook -V

第一次查看gitbook版本号的时候会安装gitbook,此时爆出两个错误。

错误1:

/usr/local/lib/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

解决方法:
降低node的版本!

brew install node@10
brew unlink node
brew switch node 10.22.0 #具体看你安装的版本号

错误2:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

解决方法:
首先去app store下载安装了xcode
然后执行:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

你可能感兴趣的:(踩坑日记——macos安装gitbook出错)