简体   繁体   English

找不到宝石铁路(> = 0.a)(Gem :: GemNotFoundException)

[英]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,可能你可以跟着,可能你错过了什么命令

  1. rbenv versions rbenv版本

    • check your rbenv version 检查你的rbenv版本
    • if you think you need to upgrade you can use command below 如果您认为需要升级,可以使用以下命令
    • brew upgrade rbenv ruby-build brew升级rbenv ruby​​-build
  2. rbenv install -l rbenv install -l

    • check list of ruby that can be installed with rbenv 检查可以用rbenv安装的ruby列表
  3. rbenv install 2.3.1 rbenv安装2.3.1

    • this is sample to install ruby version 2.3.1 这是安装ruby版本2.3.1的示例
    • ruby will be copied to /Users/%your_user_name%/.rbenv/versions/2.3.1 ruby将被复制到/Users/%your_user_name%/.rbenv/versions/2.3.1
    • this is just sample version, use the latest / stable from command number 2 这只是示例版本,使用命令编号2中的最新/稳定版
  4. rbenv rehash rbenv rehash

    • this command will apply new ruby version that you just install 此命令将应用您刚刚安装的新ruby版本
    • after you install / reinstall ruby with rbenv don't forget to run this command 使用rbenv安装/重新安装ruby后,不要忘记运行此命令
    • this is important one, that most of developers forget to apply 这是重要的一点,大多数开发人员忘记申请
  5. rbenv global 2.3.1 rbenv global 2.3.1

    • set global ruby to version 2.3.1 将global ruby​​设置为2.3.1版
  6. rbenv local 2.2.2 rbenv local 2.2.2

    • after you set global (with version 2.3.1) in case you want specific folder with version 2.2.2 you can set local folder with this command 设置全局(版本2.3.1)以防您需要2.2.2版本的特定文件夹后,可以使用此命令设置本地文件夹
  7. gem install bundler gem install bundler

    • within your active ruby this will install bundler software for specific version 在您的活动ruby中,这将为特定版本安装bundler软件
    • again after you run this do not forget to run ##rbenv rehash## 再次运行之后不要忘记运行## rbenv rehash ##
  8. gem install rails## 宝石安装导轨##

    • this will install rails (latest) 这将安装rails(最新)
    • although there are no Gemfile this will install rails 虽然没有Gemfile,但这会安装rails
    • if you like to install specific version you can use Gemfile and run command number 7 (below) 如果您想安装特定版本,可以使用Gemfile并运行命令7(如下)
  9. bundle install 捆绑安装

    • this will install rails including all dependency 这将安装包括所有依赖项的rails
    • again if you not sure / some command not work please try ##rbenv rehash## 再次,如果你不确定/某些命令不起作用请尝试## rbenv rehash ##
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.

相关问题 找不到带有可执行轨道的 gem railties (>= 0.a) (Gem::GemNotFoundException) - Can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException) Rails 找不到宝石 Railties (>=0.a) - Rails Can't Find Gem Railties (>=0.a) 找不到带有可执行 jekyll (Gem::GemNotFoundException) 的 gem jekyll (>= 0.a) - can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException) 捆绑器:在使用 gem 进行捆绑安装期间找不到带有可执行捆绑包 (Gem::GemNotFoundException) 的 gem bundler (>= 0.a) - Bundler: can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) during bundle install with gem TRAVIS CI:`find_spec_for_exe':找不到带有可执行包的 gem bundler (>= 0.a) (Gem::GemNotFoundException) - TRAVIS CI: `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) Elastic Beanstalk:找不到带有可执行包的 gem bundler (>= 0.a) (Gem::GemNotFoundException) - Elastic Beanstalk: can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) 找不到带有可执行 rdebug-ide (Gem::GemNotFoundException) 的 gem ruby​​-debug-ide (>= 0.a) - can't find gem ruby-debug-ide (>= 0.a) with executable rdebug-ide (Gem::GemNotFoundException) 找不到宝石导轨 - Gem::GemNotFoundException - can't find gem rails - Gem::GemNotFoundException 在heroku上找不到gem bundler(> = 0)(Gem :: GemNotFoundException) - can't find gem bundler (>= 0) (Gem::GemNotFoundException) on heroku 如何修复“找不到 gem railties 的可执行导轨。railties 当前不包含在捆绑包中”? - How to fix "can't find executable rails for gem railties. railties is not currently included in the bundle"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM