C:\Users\Clarion Smith\Documents\Sites\simple_cms>rails server
C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:4:in `<module:ActionView>'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:3:in `<top (required)>'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/actionview-
我的问题在Ruby和Rails中很常见。虽然我经历了不同的stackoverflow答案,但我找不到任何可以修复我的错误的具体内容。
我尝试重新安装较低版本的railites gem,但同样的错误仍然会弹出。我尝试重新安装所有抛出错误的宝石,但问题似乎并没有消失。许多文章表明这是一个兼容性问题。但是当我尝试重新安装较低版本的railties gem(4.0.0)时,命令提示符仍然要求我升级到最新版本才能继续。我还安装了'Passenger'网络服务器以检查兼容性并弹出类似的错误,但这次是乘客宝石。请相应地研究一下。我也在宝石文件下面复制。
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use mysql as the database for Active Record
gem 'mysql2'
#Bundle for Passenge r web server
gem 'passenger'
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
#gem 'uglifier', '>= 1.3.0'
gem 'rack', '~> 1.6.0'
gem 'rspec-rails', :group => [:development, :test]
# Use CoffeeScript for .coffee assets and views
#gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
#gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
#gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
#gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
答案 0 :(得分:1)
我记得以这种方式修复此错误:
卸载railties
gem。
然后在我的案例中安装rails
gem(4.0.0
的旧版本,因为这是教程中的那个。)
这为我解决了这个问题。
您尝试过这些步骤吗?
答案 1 :(得分:1)
检查您的Gemfile.lock
文件,了解所使用的nokogiri版本。我在nokogiri 1.6.6.4
遇到了同样的问题。它成功安装了必要的dll但由于某种原因它在Windows上不能很好用。
什么对我有用,希望这也适合你
gem 'nokogiri', '1.6.6.2'
放入您的宝石文件gem install --local path-to-gem/filename.gem
bundle update nokogiri
来更新依赖项。 rails s
现在应该启动服务器。答案 2 :(得分:1)
对我来说,我能够用
解决这个问题gem pristine --all