简体   繁体   English

Bundler找不到宝石“ rails”的兼容版本,但已安装版本

[英]Bundler could not find compatible versions for gem “rails”, but version is installed

Noob following installation directions from here . Noob从这里按照安装说明进行操作。

Doing a bundle install getting the following error: 进行bundle install出现以下错误:

Bundler could not find compatible versions for gem "rails":  
  In Gemfile:  
    open_conference_ware (~> 1.0.0.pre) ruby depends on
      rails (~> 4.0.2) ruby
    rails (4.1.8)

So I did sudo gem install rails -v 4.0.2 and now according to gem list : 所以我做了sudo gem install rails -v 4.0.2 ,现在根据gem list

rails (4.1.8, 4.0.2)

But I still recieve the error! 但是我仍然收到错误!
Doesn't 4.0.2 qualify? 4.0.2不符合条件吗?
Is there something I need to set to force the proper version? 我需要设置一些内容来强制使用正确的版本吗?

Yes, on both accounts. 是的,两个帐户都可以。 (Please see EDIT below) (请参见下面的编辑

When you run rails new SOMEPROJECT --skip-bundle it will auto generate a file called Gemfile . 当您运行rails new SOMEPROJECT --skip-bundle ,它将自动生成一个名为Gemfile的文件。 (Think of it as a header file as it includes the dependencies for SOMEPROJECT that Bundler will setup for you.) When it is generated, it will automatically default to the most current version installed on your system. (将其视为头文件,因为它包括Bundler将为您设置的SOMEPROJECT依赖SOMEPROJECT 。)生成时,它将自动默认为系统上安装的最新版本。 So you must modify it to point to the proper version of rails: 因此,您必须修改它以指向正确的rails版本:

Change line gem 'rails', '4.1.8' to gem 'rails', '4.0.2' . 将行gem 'rails', '4.1.8'更改为gem 'rails', '4.0.2'

Now you can continue with bundle install . 现在,您可以继续进行bundle install

EDIT : Because you will likely run into this issue later, it is better to regenerate the project altogether by specifying the version in the rails new command : 编辑 :因为您以后可能会遇到问题,所以最好通过rails new命令中指定版本来重新生成项目:

rm -r SOMEPROJECT
rails _4.0.2_ new SOMEPROJECT --skip-bundle

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ruby 导轨错误:捆绑器找不到 gem“捆绑器”的兼容版本: - Ruby rails error: Bundler could not find compatible versions for gem "bundler": Bundler 找不到 gem“bundler”的兼容版本: - Bundler could not find compatible versions for gem "bundler": Bundler找不到宝石“ bundler”的兼容版本 - Bundler could not find compatible versions for gem “bundler” ActiveAdmin with Rails 4:Bundler找不到宝石“ rails”的兼容版本 - ActiveAdmin with Rails 4: Bundler could not find compatible versions for gem “rails” Bundler 找不到 gem 的兼容版本。 版本在范围内 - Bundler could not find compatible versions for gem. The version is within range Chage Rails版本冲突发生后。Bundler找不到与gem兼容的版本 - After Chage Rails version conflict occured .Bundler could not find compatible versions for gem 如何在项目中更新Rails的版本? Bundler找不到宝石“ activemodel”的兼容版本 - How do I update the version of Rails in my project? Bundler could not find compatible versions for gem “activemodel” 安装 Rails 6 - Bundler 找不到 gem actionpack 的兼容版本 - Install Rails 6 - Bundler could not find compatible versions for gem actionpack Bundler找不到宝石“ sass-rails”的兼容版本 - Bundler could not find compatible versions for gem “sass-rails” Bundler找不到与gem“ actionpack”兼容的版本-Rails - Bundler could not find compatible versions for gem “actionpack” - Rails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM