我的应用程序出错了,所以我查看了堆栈并找到了答案undefined method `require_relative' for main:Object (NoMethodError)它说我应该运行gem install rails
我做了之后,我跑了之后,当我试图运行rails generate controller StaticPages home help --no-test-framework
我收到了一个错误:
(in /usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/usr/local/rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rails-0.9.5/Rakefile:3:in `<top (required)>'
它说我正在运行rails .95,甚至当我运行gem update rails
时没有发生任何事情
这是我的宝石文件
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.2'
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
答案 0 :(得分:0)
尝试删除Gemfile.lock
(或者移动它)。这对我有用。