2017-09-26 129 views
0

我工作的一個項目,在紅寶石2.1.10。它應該使用rails 4.0.13。安裝軌與舊紅寶石

我使用rbenv。

我已經安裝了一切,我相信。我運行項目的捆綁安裝。最終我得到它運行。

不過,現在我得到:

turlingdrome$ rails 
Rails is not currently installed on this system. To get the latest version, simply type: 

    $ sudo gem install rails 

You can then rerun your "rails" command. 

turlingdrome$ gem install rails -v 4.0.13 
Successfully installed rails-4.0.13 
Parsing documentation for rails-4.0.13 
Done installing documentation for rails after 1 seconds 
1 gem installed 

turlingdrome$ which rails 
/Users/brianp/.rbenv/shims/rails 

turlingdrome$ rails -v 
Rails is not currently installed on this system. To get the latest version, simply type: 

    $ sudo gem install rails 

You can then rerun your "rails" command. 

turlingdrome$ ruby -v 
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin16.0] 

在如此重要的情況下,我在運行從評論10.12.6

ETA一個MAC:

turlingdrome$ bundle exec rails -v 
Rails 4.0.13 

所以,捆綁exec讓我運行rails。 rbenv的exec軌道似乎也工作。

所以,這個問題似乎是在墊片!

+0

你有[配置rbenv不使用sudo(https://stackoverflow.com/questions/28890719/how-to-install-a-gem-globally-without-sudo-using-rbenv)?你也可以嘗試把鐵軌在Gemfile中,運行捆綁,然後'捆綁高管rails' –

+0

我敢肯定它不會使用sudo。並且rails已經在Gemfile中。它第一次安裝。軌道似乎不知道它。 –

+0

啊!看來我的問題可能是以前使用rvm的遺留問題?當嘗試在一個新的外殼,它似乎工作。 –

回答

1

老調重彈的墊片:

rbenv rehash 

現在,你應該能夠只rails沒有bundle execrbenv exec運行。