Sass 安裝 及其常見錯誤的解決辦法

Sass是一種css的開發工具,它的安裝依賴Ruby,沒有安裝Ruby的請先安裝Ruby。

假定你已經安裝了Ruby,則可以直接執行如下語句進行安裝。

 

gem install sass

 常見錯誤提示:

 

1、ERROR:  While executing gem ... (OpenSSL::SSL::SSLError)

 

    hostname "gems.ruby-china.org" does not match the server certificate

解決辦法:

執行命令,查看數據源

 

gem source -l

 結果

 

 

*** CURRENT SOURCES ***

https://ruby.taobao.org/
https://gems.ruby-china.org

 

 

則可以刪除多餘的

 

gem sources --remove https://ruby.taobao.org/
sudo gem update --system

 然後重新安裝。

 

2、ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)

ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store

Fetching: ffi-1.9.18.gem ( 32%)ERROR:  SSL verification error at depth 2: self signed certificate in certificate chain (19)

ERROR:  Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)

ERROR:  While executing gem ... (OpenSSL::SSL::SSLError)

    hostname "gems.ruby-china.org" does not match the server certificate

 

3、ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)

ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store

Fetching: ffi-1.9.18.gem (100%)

Building native extensions.  This could take a while...

Successfully installed ffi-1.9.18

ERROR:  SSL verification error at depth 2: self signed certificate in certificate chain (19)

ERROR:  Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)

Fetching: rb-inotify-0.9.10.gem (100%)

Successfully installed rb-inotify-0.9.10

Fetching: sass-listen-4.0.0.gem (100%)

Successfully installed sass-listen-4.0.0

Fetching: sass-3.5.1.gem (100%)

ERROR:  While executing gem ... (Errno::EPERM)

    Operation not permitted - /usr/bin/sass

 

遇到以上錯誤 2和3的解決辦法

 

sudo gem install -n /usr/local/bin sass

 查看 

sass -v

 則會正確顯示Sass版本號。

 

 

2017年12月28日更新:

Mac更新系統後,Ruby由2.0升級到2.3,再次使用Sass時候,發現報錯。

於是決定升級SaaS,重新安裝時遇到錯誤。最後找到解決方案:

先安裝libgmp-dev,再重新安裝即可。

brew install libgmp-dev
sudo gem install -n /usr/local/bin sass

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章