ruby-on-rails – 尝试使用rails的angularjs时出错:未定义的方法`register_engine’用于nil:NilClass(NoMethodError)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 尝试使用rails的angularjs时出错:未定义的方法`register_engine’用于nil:NilClass(NoMethodError)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是新来的两个角和轨道.
在我的新公司,我们必须在rails上使用 ruby.在rails上分别使用angularjs和ruby的教程之后,我正在尝试使用以下链接来协同工作:
https://thinkster.io/angular-rails#generating-activerecord-models
在运行rails s命令后,按照所有步骤操作,直到“集成前端与资产管道”(包括主题中的步骤)出现以下错误
=> Booting WEBrick
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
**/home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/angular-rails-templates-0.1.4/lib/angular-rails-templates/engine.rb:49:in `block (2 levels) in <class:Engine>': undefined method `register_engine' for nil:NilClass (NoMethodError)**
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/angular-rails-templates-0.1.4/lib/angular-rails-templates/engine.rb:39:in `each'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/angular-rails-templates-0.1.4/lib/angular-rails-templates/engine.rb:39:in `block in <class:Engine>'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /home/cb/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/application.rb:352:in `initialize!'
    from /home/cb/flapper-news/config/environment.rb:5:in `<top (required)>'
    from /home/cb/flapper-news/config.ru:3:in `require'
    from /home/cb/flapper-news/config.ru:3:in `block in <main>'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /home/cb/flapper-news/config.ru:in `new'
    from /home/cb/flapper-news/config.ru:in `<main>'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/server.rb:61:in `app'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/server.rb:139:in `log_to_stdout'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/server.rb:78:in `start'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/cb/flapper-news/bin/rails:9:in `require'
    from /home/cb/flapper-news/bin/rails:9:in `<top (required)>'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/lib/spring/client/rails.rb:28:in `load'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/lib/spring/client/rails.rb:28:in `call'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/lib/spring/client/command.rb:7:in `call'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/lib/spring/client.rb:28:in `run'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/bin/spring:51:in `<top (required)>'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/lib/spring/binstub.rb:11:in `load'
    from /home/cb/.rvm/gems/ruby-2.2.3@flapper-news/gems/spring-1.6.0/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/cb/flapper-news/bin/spring:13:in `require'
    from /home/cb/flapper-news/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

使用rails版本4.2.5

以下是Gemfile的代码片段:

source 'https://rubygems.org'

    gem 'angular-rails-templates'

    gem 'rails','4.2.5'

    gem 'sqlite3'

    gem 'sass-rails','~> 5.0'

    gem 'uglifier','>= 1.3.0'

    gem 'jbuilder','~> 2.0'

    gem 'sdoc','~> 0.4.0',group: :doc


    group :development,:test do

      gem 'byebug'

    end

group :development do

gem 'web-console','~> 2.0'

gem 'spring'

end

解决方法

我遇到过同样的问题.这是与“链轮”有关的问题.尝试安装一个旧版本的宝石“链轮”,“2.12.3”添加到您的宝石文件,然后通过运行捆绑更新来更新您的宝石. 它为我工作
原文链接:https://www.f2er.com/ruby/272989.html

猜你在找的Ruby相关文章