[英]can't find gem railties (>= 0.a) (Gem::GemNotFoundException)
I've seen a few other issues for this, tried their recommendations, none of them worked for me. 我已经看到了其他一些问题,尝试了他们的建议,但没有一个适合我。
I've been using Rails for about a year, just started a new Rails project, and suddenly having issues. 我已经使用Rails大约一年了,刚开始一个新的Rails项目,突然出现问题。 I uninstalled and tried reinstalling all of Ruby and Rails.
我卸载并尝试重新安装所有的Ruby和Rails。 Ruby is fine, but not Rails.
Ruby很好,但不是Rails。
When I enter rails s
, I get the can't find gem railties
. 当我进入
rails s
,我can't find gem railties
。 My current Ruby version is ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin15]
, even though I've been trying to set ruby 2.3.0 through rbenv. 我目前的Ruby版本是
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin15]
版ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin15]
,即使我一直试图通过rbenv设置ruby 2.3.0。
If I try rails -v
to see what version I'm running, I get the same error. 如果我尝试
rails -v
来查看我正在运行的版本,我会得到同样的错误。 I'm using Mac OS X El Capitan version 10.11.6. 我使用的是Mac OS X El Capitan版本10.11.6。
Below is some step by step to install rails with RBENV, probably you can follow along, what command that probably you missed 下面是一步一步用RBENV安装rails,可能你可以跟着,可能你错过了什么命令
rvm osx-ssl-certs
rvm cleanup all
rvm reset
It works for me! 这个对我有用! Maybe some commands useless, I just retell the history of my shell :)
也许有些命令没用,我只是复述我的shell的历史:)
For some reason, I can get it to work using bundle exec rails s. 出于某种原因,我可以使用bundle exec rails来使用它。 It's not ideal, but, if that's what it takes I'll just keep using bundle exec rails s.
这不是理想的,但是,如果这就是我需要的东西,我将继续使用bundle exec rails。
UPDATE: This no longer works, it was only temporary. 更新:这不再有效,只是暂时的。 I had rbenv installed, and no matter what version I tried to set as local or global, it didn't set.
我安装了rbenv,无论我尝试将其设置为本地版本还是全局版本,都没有设置。 Turned out, that my path was messed up, and it was hitting usr/local/bin first rather than hitting .rbenv first.
原来,我的路径搞砸了,它首先击中了usr / local / bin,而不是首先击中.rbenv。 Someone was able to help me offline.
有人能够帮助我离线。 :)
:)
This solution worked for me while i have been using Ubuntu 16.04. 当我使用Ubuntu 16.04时,这个解决方案对我有用。
Make sure that rvm(Ruby version manager) is accessible to your terminal, by simply execute command 通过执行命令确保终端可以访问rvm(Ruby版本管理器)
$ rvm -v
Now run following commands=> 现在运行以下命令=>
$ rvm gemset list
Output of above command will be 输出以上命令即可
gemsets for ruby-2.5.3 (found in /home/rails/.rvm/gems/ruby-2.5.3) gemy for ruby-2.5.3(见/home/rails/.rvm/gems/ruby-2.5.3)
=>(default) =>(默认)
carserv carserv
global 全球
Now set correct gemset instead of default. 现在设置正确的gemset而不是默认值。 in my project it is carserv .
在我的项目中它是carserv 。 For that use following command
为此使用以下命令
$ rvm gemset use carserv
It's time to start your rails server. 是时候启动rails服务器了。
$ rails server
I hope this process will help you. 我希望这个过程对你有所帮助。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.