public
Last active

rbenv に変更した後 bundle install できない件

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
rvmを削除してrbenv+ruby-buildに変更して1.9.3-p194をビルドしましたが、Gemfileのなかの
gem 'turn', require: false
こういうハッシュでエラーが出ます。どうしたら良いでしょうか!?
 
[~/work/Rails/Gettan]$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
 
[~/work/Rails/Gettan]$ rbenv version
1.9.3-p194 (set by /Users/imaz/.rbenv/version)
 
[~/work/Rails/Gettan]$ which gem
/Users/imaz/.rbenv/shims/gem
 
[~/work/Rails/Gettan]$ which bundle
/usr/bin/bundle
 
[~/work/Rails/Gettan]$ bundle install
/Users/imaz/work/Rails/Gettan/Gemfile:44:in `evaluate': compile error (SyntaxError)
/Users/imaz/work/Rails/Gettan/Gemfile:35: syntax error, unexpected ':', expecting kEND
gem 'turn', require: false
^
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:17:in `build'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler.rb:136:in `definition'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19

まず、 ruby 1.9.3 の bundler が使われてないように見えます。
次のコマンドで ruby 1.9.3 に bundelr をインストールしてみてください。

$ gem install bundler
$ rbenv rehash

その後、bundler のパスがどこになっているか確認してもらえますかー?

$ which bundle

(/Users/imaz/.rbenv/shims/bundle とかだと work しそう)

あ、あとは PATH の解決順序の問題もあるので、which bundle の結果が上のようになっても上手くいかない場合は、

$ echo $PATH

とかで PATH の順番を確認してもらえるとよいかもです!

$ gem install bundler
Fetching: bundler-1.2.1.gem (100%)
Successfully installed bundler-1.2.1
1 gem installed
Installing ri documentation for bundler-1.2.1...
Installing RDoc documentation for bundler-1.2.1...
$ rbenv rehash
$ which bundle
/Users/imaz/.rbenv/shims/bundle

こうなりました! しかし、エラーメッセージは変わらないです...><

$ echo $PATH
/Users/imaz/.rbenv/shims:/Users/imaz/.rbenv/bin:/usr/local/bin:/Users/imaz/.rbenv/shims:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/imaz/.rbenv/bin

PATHはこんな感じで、.bashrcのPATH設定とrbenvの設定はこんな感じです!

 PATH=/usr/local/bin:$PATH
 PATH=$HOME/.rbenv/bin:$PATH
 eval "$(rbenv init -)"
PATH=$HOME/.rbenv/bin:$PATH
PATH=/usr/local/bin:$PATH
eval "$(rbenv init -)"

こう変更したらいけましたー!
ありがとうございます!:joy:

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.