Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 执行'时出现名称错误;轨道s';_Ruby On Rails - Fatal编程技术网

Ruby on rails 执行'时出现名称错误;轨道s';

Ruby on rails 执行'时出现名称错误;轨道s';,ruby-on-rails,Ruby On Rails,我为Rails开始了本教程。我刚刚创建了应用程序,打算测试默认的欢迎页面,结果如下: D:\Programming\Rails Projects\simpleCMS>rails server C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionVie

我为Rails开始了本教程。我刚刚创建了应用程序,打算测试默认的欢迎页面,结果如下:

D:\Programming\Rails Projects\simpleCMS>rails server
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:4:in `<module:ActionView>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:3:in `<top (required)>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/base.rb:5:in `require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/base.rb:5:in `<top (required)>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:7:in `<class:Template>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:6:in `<module:WebConsole>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:1:in `<top (required)>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `<top (required)>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `<top (required)>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
            from D:/Programming/Rails Projects/simpleCMS/config/application.rb:7:in `<top (required)>'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:78:in `require'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:78:in `block in server'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
            from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
            from bin/rails:4:in `require'
            from bin/rails:4:in `<main>'

您可能需要绑定一个ip地址 你为什么不试试这个呢:
rails服务器-b localhost卸载
railties
gem,因为仅仅卸载
rails
gem是不起作用的。然后安装一个较旧版本的
rails
gem(在我的例子中是4.0.0,因为那是tutotial提供的)


这解决了问题。

config/application.rb
的第7行有什么?
Bundler.require(*Rails.groups)
尝试注释该行,使其不会运行,并添加以下行:
Bundler.require(:default,Rails.env)
。不确定它是否能工作,但我对你的语法听起来不是很熟悉……与之前的@RubyRacer完全相同。至于语法,我甚至还没来得及编辑哪怕一行代码,所以这就是Rails自己所做的。正如我所说的,我不确定。在尝试运行服务器之前,您是否运行了
bundle install
?您应该详细解释解决方案。我假设他已经执行了db:migrate&db:seed,因此他执行了rails server;我在网上参加了一个saas课程,但我记得,有时根据你运行应用程序的位置,你可能需要添加“-B127.0.0.1”(即本地主机),但是如果你使用cloud9或nitrous,那么它会有所不同,但仍然是-b###(一些ip地址)。够清楚吗?
source 'https://rubygems.org'
gem 'rails', '4.2.3'
gem 'mysql2'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
    gem 'byebug'
    gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]