[英]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.