由于Json gem,我无法运行rails

时间:2017-10-18 05:07:16

标签: ruby-on-rails json active-model-serializers

我一直在寻求帮助,因为我无法运行我的项目。我使用序列化程序和Json为我的rails项目添加了一个API,但问题是当我运行rails时,我在控制台上遇到了这个错误。我已经尝试了以下

  • Bundle
  • 捆绑安装
  • 重建所有宝石
  • 删除Json文件并将其添加到Gem文件
  • 从Gemfile.lock中删除所有JSON条目

 home/leandro/.rvm/gems/ruby-2.2.1/gems/active_model_serializers-0.10.6/lib/active_model/serializer.rb:2:in `require': cannot load such file -- jsonapi/include_directive (LoadError)
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/active_model_serializers-0.10.6/lib/active_model/serializer.rb:2:in `<top (required)>'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/active_model_serializers-0.10.6/lib/active_model_serializers.rb:50:in `require'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/active_model_serializers-0.10.6/lib/active_model_serializers.rb:50:in `<module:ActiveModelSerializers>'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/active_model_serializers-0.10.6/lib/active_model_serializers.rb:6:in `<top (required)>'
            from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:77:in `require'
            from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:77:in `block (2 levels) in require'
            from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `each'
            from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block in require'
            from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:61:in `each'
            from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:61:in `require'
            from /usr/lib/ruby/vendor_ruby/bundler.rb:99:in `require'
            from /home/leandro/Documents/ruby/rails/bookstore/config/application.rb:7:in `<top (required)>'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `require'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `block in server'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
            from /home/leandro/Documents/ruby/rails/bookstore/bin/rails:9:in `require'
            from /home/leandro/Documents/ruby/rails/bookstore/bin/rails:9:in `<top (required)>'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
            from /home/leandro/.rvm/gems/ruby-2.2.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
            from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
            from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
            from /home/leandro/Documents/ruby/rails/bookstore/bin/spring:15:in `<top (required)>'
            from bin/rails:3:in `load'
            from bin/rails:3:in `<main>'

提前感谢您的帮助

1 个答案:

答案 0 :(得分:0)

尝试运行bundle exec rails s