简体   繁体   English

在优胜美地上安装SASS

[英]Installing SASS on Yosemite

I'm struggling with an error in my command line while trying to install SASS. 尝试安装SASS时,我在命令行中遇到错误。

I'm just following what SASS website recommend to type in the command line: 我只是遵循SASS网站建议在命令行中键入的内容:

sudo gem install sass

and here is the error I got: 这是我得到的错误:

    My-MacBook-Pro:~ username$ gem install sass
ERROR:  Could not find a valid gem 'sass' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)
ERROR:  Possible alternatives: sass

Then when I try to test if it installed with command line: 然后,当我尝试测试是否通过命令行安装时:

sass -v

I got: 我有:

-bash: sass: command not found

I have a 2015 macbook pro with the latest OSX Yosemite. 我有一个配备最新OSX Yosemite的2015年款Macbook Pro。

Alternatively, how could I install SASS manually? 或者,如何手动安装SASS? I see it trying to download https://rubygems.org/latest_specs.4.8.gz . 我看到它试图下载https://rubygems.org/latest_specs.4.8.gz

Thanks in advance for your help! 在此先感谢您的帮助!

That's probably because the servers serving gems are blocked in China (for whatever reason that is). 这可能是因为服务于gems的服务器在中国被封锁了(无论出于何种原因)。 An easier way to solve this would be: 解决此问题的更简单方法是:

  1. Open a terminal 打开一个终端
  2. gem sources -r https://rubygems.org/
  3. gem sources -a https://ruby.taobao.org/ (this is a mirror of rubygems.org) gem sources -a https://ruby.taobao.org/ (这是rubygems.org的镜像)
  4. gem update --system
  5. sudo gem install sass

Done. 做完了 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM