我尝试创建一个新项目时出现Rails错误

时间:2014-05-15 11:35:03

标签: ruby-on-rails ruby

rails的新手,我一直在关注RailsTutorial。 我已经能够推动并创建其他2个项目然后就出错了。在OSX Mavericks上运行。

我有一个名为' workspace'的工作文件夹。

当我运行ruby -v时,我得到了

ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin12.5.0]

当我运行rails -v:

Rails 4.0.5 

然后我试过了两个:

rails new sample_app --skip-test-unit

和:

rails _4.0.5_ new sample_app --skip-test-unit

(安装并运行正常)

然后我这样做:cd sample_app,出现:

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /Users/sebastian/workspace/sample_app/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

我继续请求ruby -v和rails-v在内部并且它是相同的。到目前为止工作正常。

然后教程要我删除当前的gemfile并将其替换为:

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.5'

group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end

group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
gem 'sdoc', '0.3.20', require: false
end

group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end

一旦我更新了我的gemfile,我就会在rails -v

上收到此错误
Could not find gem 'rails_12factor (= 0.0.2) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

教程要我

$bundle install --without production
$ bundle update
$ bundle install

如果我捆绑安装 - 没有生产 我收到这个错误:

An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.

将这些东西放在首位:

http://i.stack.imgur.com/XwA4q.png

所以我该如何解决这个问题呢?我究竟做错了什么。非常友好的回答会很好。

1 个答案:

答案 0 :(得分:1)

确保您的Gemfile列出了rails_12factor(数字12,而不是字母L然后2.只需更改此内容即可为我修复:

组:生产做     宝石'',' 0.17.1'     gem' rails_12factor',' 0.0.2' 端

按照相同的教程,我猜。

相关问题