项目场景:
今天心血来潮给mac上准备安装一下sass,以前都是项目中有所以也就没有安装,今天安装了一下各种报错,简单的记录一下
问题描述:
一、运行 gem install sass
然后就是各种错误,懵逼了我不知道怎么继续下去了,只能在网上搜索可行的方案,结果找到了说是ruby的版本太低了,好吧 !那就升级ruby!
1、更新 brew
brew update
然后又是各种报错,太难了我!
Error:
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
....
2、升级brew
整合了一下搜索的方案,说是只要删除homebrew-core后更新即可,安排上吧
cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
brew upgrade
这一顿操作完之后又又出现问题了:
Error:
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
我去文件夹看了看,homebrew-core这个文件夹不见了,哦哦,刚才被我删除了,没辙了我就直接克隆一个好了
mkdir homebrew
git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
3、查看brew是否成功
另起窗口,输入brew
OK,自此brew升级成功!
二、升级ruby
1、通过brew升级ruby
brew install ruby
然后跟新版本
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
ruby -v
2、安装sass
gem install sass
额,又又又出问题了
sass-v
zsh: command not found: sass
查看一下组件安装了没有
gem list
安装了那就说明没有关联到:
export PATH="/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"
sass-v
OK,至此安装完成,搞定,实在是太难了!