简体   繁体   English

创建新的Ruby on Rails 3.0项目时出错

[英]Error creating new Ruby on Rails 3.0 project

I' trying to make my first steps with Ruby on Rails. 我正在尝试使用Ruby on Rails迈出第一步。 I'm working on a Ubuntu 14.04. 我正在使用Ubuntu 14.04。 As suggested by a website, I've installed rvm to manage my Ruby installations and gem sets. 根据网站的建议,我已经安装了rvm来管理我的Ruby安装和gem套。 The commands I've used are 我使用的命令是

rvm install ruby-1.9.2-p320
rvm use --default 1.9.2-p320
gem install rails -v 3.0

At the moment, this is the situation with the installation 目前,这就是安装的情况

<01/nov 15:25> [Ruby_On_Rails]$ rvm list
rvm rubies

=* ruby-1.9.2-p320 [ x86_64 ]
ruby-1.9.3-p547 [ x86_64 ]
ruby-2.1.2 [ x86_64 ]
ruby-head [ x86_64 ]

# => - current
# =* - current && default
#  * - default

and here is the gemset list 这是宝石集列表

<01/nov 15:28> [Ruby_On_Rails]$ rvm gemset list

gemsets for ruby-1.9.2-p320 (found in /home/lorenzo/.rvm/gems/ruby-1.9.2-p320)
=> (default)
global

finally, here is the gem list 最后,这是宝石清单

<01/nov 15:30> [Ruby_On_Rails]$ gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
builder (2.1.2)
bundler (1.7.4, 1.0.22)
bundler-unload (1.0.2)
erubis (2.6.6)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
i18n (0.7.0.beta1, 0.4.2)
json (1.8.1)
mail (2.2.20)
mime-types (1.25.1)
minitest (5.4.2, 1.6.0)
polyglot (0.3.5)
rack (1.2.8)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.0)
railties (3.0.0)
rake (0.8.7)
rdoc (2.5.8)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
thor (0.14.6)
thread_safe (0.3.4)
treetop (1.4.15)
tzinfo (1.2.2, 0.3.42)

When I try to launch rails new, it gives me an error becuse one of the ruby gems is in conflict with rails 3.0 当我尝试启动新的Rails时,它会给我一个错误,因为其中一个红宝石宝石与Rails 3.0冲突

<01/nov 15:22> [Ruby_On_Rails]$ rails --version
/home/lorenzo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:2064:in `raise_if_conflicts': Unable to activate rails-3.0.0, because bundler-1.7.4 conflicts with bundler (~> 1.0.0) (Gem::LoadError)
    from /home/lorenzo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1262:in `activate'
    from /home/lorenzo/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:54:in `gem'
    from /home/lorenzo/.rvm/gems/ruby-1.9.2-p320/bin/rails:22:in `<main>'
    from /home/lorenzo/.rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in `eval'
    from /home/lorenzo/.rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in `<main>'

In fact, I have two versions of bundler. 实际上,我有两个版本的捆绑器。 I'm not an expert, but I think that "bundler (~> 1.0.0)" means bundler 1.0.x, so it gives me problem because the version is "too new" for rails. 我不是专家,但是我认为“ bundler(〜> 1.0.0)”意味着捆扎机1.0.x,因此它给我带来了问题,因为该版本对于rails而言“太新了”。 Now I'd like to understant the "correct" action to perform to make a coherent situation. 现在,我想低调执行“连贯”情况的“正确”行动。 Should I uninstall bundler 1.7.2? 我应该卸载捆绑程序1.7.2吗? Are ruby 1.9.2 and rails 3.0 incompatible? 红宝石1.9.2和Rails 3.0不兼容吗?

The main problem is that I'm new with Ruby, so maybe there is something obiouvs that I've not seen in the outputs of the commands. 主要问题是我是Ruby的新手,所以也许有些东西在命令输出中没有出现。 I've tried to google a bit, but I've found anything, so any help would be appreciated. 我尝试了一下Google,但是我发现了任何东西,因此对您的帮助将不胜感激。

Try: 尝试:

gem uninstall bundler
gem install bundler --version '1.0.0'

then: 然后:

bundle

PS PS

I totally agree with @meagar, unless you are forced to with legacy code you should move forward to a more recent version of rails ... you will miss lots of fun! 我完全同意@meagar,除非您被迫使用遗留代码,否则应该继续使用最新版本的rails ...您将错过很多乐趣!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM