寫CSS一陣子了

決定學習SASS來增進撰寫效率

一直都超忙 所以電腦一直沒裝過

決定今晚一定要裝好

結果安裝超久遇到超多奇怪的問題

弄到晚上三點,足足搞了我三個小時半

絕對記錄一下遇到的每一個錯誤與解法 還有注意事項 並非流程喔。

 

1.注意:Xcode請至App Store更新到最新版

--

以下直接進入Terminal

2.注意:Ruby更新到最新版

sudo gem install rubygems-update

sudo update_rubygems

ruby -v

 

 

3.解法:安裝Xcode管理工具

ERROR: Failed to build gem native extension.

current directory: /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.18/ext/ffi_c

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20170821-21856-ns4gm.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.18 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/ffi-1.9.18/gem_make.out

sudo xcode-select --install

 

4.解法:記得同意Xcode條款(重要,卡在這好久)

package configuration for libffi is not found
"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17 -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -iwithsysroot /usr/local/libressl/include conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib   -arch x86_64 -arch i386   -lruby.2.3.0  -lpthread -ldl -lobjc "

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

sudo xcodebuild -license

 

5.依照官網安裝,順利的話就能安裝成功~

sudo gem install sass

 

6.解法:若安裝時依舊無權限安裝,就以下列方式新建。

ERROR:  While executing gem ... (Gem::FilePermissionError)

You don't have write permissions for the /usr/bin directory.

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

 

最後看到“Sass 3.5.5 (Bleeding Edge) ”的時候都快喜極而泣了

文章標籤
創作者介紹
創作者 Askie 的頭像
Askie

Askie's blog|與大家分享美好的生活、推薦實用的everything!

Askie 發表在 痞客邦 留言(0) 人氣()