環境
- OS : macOS Sierra version10.12.4 64bit
- Sass : 3.4.24 (Selective Steve)
- Rubugems : 2.6.11
- Homebrew : 1.2.3
- Compassなし
事象
[warning]だし・・・なんか動いているのですが、気になりす。
$ sass --watch sass:css --sourcemap=none
>>> Sass is watching for changes. Press Ctrl-C to stop.
[Listen warning]:
Listen will be polling for changes. Learn more at https://github.com/guard/listen#polling-fallback.
>>> Change detected to: sass/style.scss
write css/style.css
原因 : Listenがインスールされていないから
対応方法 : Listenをインスールする
$ sudo gem install listen
Password:
Fetching: rb-fsevent-0.9.8.gem (100%)
Successfully installed rb-fsevent-0.9.8
Fetching: ffi-1.9.18.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-1.9.18
Fetching: rb-inotify-0.9.10.gem (100%)
Successfully installed rb-inotify-0.9.10
Fetching: ruby_dep-1.5.0.gem (100%)
Successfully installed ruby_dep-1.5.0
Fetching: listen-3.1.5.gem (100%)
Successfully installed listen-3.1.5
Parsing documentation for rb-fsevent-0.9.8
Installing ri documentation for rb-fsevent-0.9.8
Parsing documentation for ffi-1.9.18
Installing ri documentation for ffi-1.9.18
Parsing documentation for rb-inotify-0.9.10
Installing ri documentation for rb-inotify-0.9.10
Parsing documentation for ruby_dep-1.5.0
Installing ri documentation for ruby_dep-1.5.0
Parsing documentation for listen-3.1.5
Installing ri documentation for listen-3.1.5
Done installing documentation for rb-fsevent, ffi, rb-inotify, ruby_dep, listen after 15 seconds
5 gems installed
$ sass --watch sass:css --sourcemap=none
>>> Sass is watching for changes. Press Ctrl-C to stop.
>>> Change detected to: sass/style.scss
write css/style.css
道のり : Listenのインストールでエラーになった
- 事象 :
ruby_dep requires Ruby version >= 2.2.5, ~> 2.2.
$ sudo gem install listen
Password:
Fetching: rb-fsevent-0.9.8.gem (100%)
Successfully installed rb-fsevent-0.9.8
Fetching: ffi-1.9.18.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-1.9.18
Fetching: rb-inotify-0.9.10.gem (100%)
Successfully installed rb-inotify-0.9.10
Fetching: ruby_dep-1.5.0.gem (100%)
ERROR: Error installing listen:
ruby_dep requires Ruby version >= 2.2.5, ~> 2.2.
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
- 理由 :
- rubyのバージョンが2.2.5より古いから
- 今回の場合 : 真の原因は新しいバージョンのrubyにパスが通っていなかったことでした
- 対応 : rubyの新しいバージョンをインストールする
$ gem install ruby <---- 自動で最新がインストールされるわけではなかった・・・
Fetching: ruby-0.1.0.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
$ sudo gem uninstall ruby <--------- 古いのをアンインストール
$ sudo gem install ruby <----------- 今一度インストール
Fetching: ruby-0.1.0.gem (100%)
Successfully installed ruby-0.1.0
Parsing documentation for ruby-0.1.0
Installing ri documentation for ruby-0.1.0
1 gem installed
$ ruby -v <--------------- バージョンが・・・上がらない・・・(ホントはここで新しいバージョンのrubyはインストールされていました。)
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
$ brew doctor
Your system is ready to brew.
$ brew install ruby <------------ Homebrewでrubyをインストール
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 4 taps (caskroom/cask, homebrew/core, homebrew/php, homebrew/science).
==> New Formulae
<省略>
==> Updated Formulae
<省略>
==> Renamed Formulae
<省略>
==> Deleted Formulae
<省略>
==> Installing dependencies for ruby: libyaml
==> Installing ruby dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.7.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.1.7.sierra.bottle.tar.gz
==> Using the sandbox
🍺 /usr/local/Cellar/libyaml/0.1.7: 8 files, 312.6KB
==> Installing ruby
==> Downloading https://homebrew.bintray.com/bottles/ruby-2.4.1_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ruby-2.4.1_1.sierra.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/ruby
==> Summary
🍺 /usr/local/Cellar/ruby/2.4.1_1: 1,191 files, 15.5MB
$ ruby -v <------------- 2.4.1をインストールしたのに・・・
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
$ which ruby <------------- パスが通っていない・・・・
/usr/local/bin/ruby
$ cd ~
mananoMacBookAir:~ mana$ vi .bashrc <---------- ターミナルでbashをつかっているので「.bashrc」でHomebrewのインストール場所へパス設定します
mananoMacBookAir:~ mana$ source .bashrc
mananoMacBookAir:~ mana$ ruby -v <------------ やっとバージョンが上がってListenをインストールできました。
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
- 解決してから気が付いたこと
- gemでインストールしたrubyにもパスが通っていなかった
- gemでインストールしたrubyにもパスが通っていなかった
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.11
- RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/mana/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/mana/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.4.1_1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.4.0
- /Users/mana/.gem/ruby/2.4.0
- /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/gems/2.4.0
- GEM CONFIGURATION: