Project

General

Profile

Actions

Defect #25241

closed

rake LoadError: cannot load such file -- json

Added by ChunChang (Nagaharu) Lo about 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Hello,

After upgrading to Redmine 3.3.2.devel.16332, my installation can't run any 'bundle exec rake' command successfully.
I've to add 'gem "json"' to Gemfile in order to get 'bunble exec rake' command ran.
Is this a bug? or Is there anything wrong with my installation?

Actions #1

Updated by Toshi MARUYAMA about 7 years ago

  • Status changed from New to Needs feedback

Please describe more details about your environment. Ref: submissions.

Actions #2

Updated by ChunChang (Nagaharu) Lo about 7 years ago

  • output of `ruby bin/about`
    Environment:
      Redmine version                3.3.2.devel.16343
      Ruby version                   2.0.0-p648 (2015-12-16) [x86_64-linux]
      Rails version                  4.2.8
      Environment                    production
      Database adapter               Mysql2
    SCM:
      Subversion                     1.7.14
      Git                            1.8.3.1
      Filesystem
    Redmine plugins:
      no plugin installed
    
    • OS: CentOS 7.3
Actions #3

Updated by Toshi MARUYAMA about 7 years ago

I cannot reproduce.
activesupport 4.2.7.1 requires json gem.
https://github.com/rails/rails/blob/v4.2.7.1/activesupport/activesupport.gemspec#L24

Actions #4

Updated by Toshi MARUYAMA about 7 years ago

Toshi MARUYAMA wrote:

activesupport 4.2.7.1 requires json gem.
https://github.com/rails/rails/blob/v4.2.7.1/activesupport/activesupport.gemspec#L24

This json gem requiring is removed in activesupport 4.2.8.
https://github.com/rails/rails/commit/89a532dfaf5910891ea3acd77d36fbaa4cb8fd0b

Actions #5

Updated by ChunChang (Nagaharu) Lo about 7 years ago

The error message is:

rake aborted!
LoadError: cannot load such file -- json
/usr/local/share/gems/gems/activesupport-4.2.8/lib/active_support/core_ext/object/json.rb:2:in `require'
/usr/local/share/gems/gems/activesupport-4.2.8/lib/active_support/core_ext/object/json.rb:2:in `<top (required)>'
/usr/local/share/gems/gems/activesupport-4.2.8/lib/active_support/core_ext/object.rb:12:in `require'
/usr/local/share/gems/gems/activesupport-4.2.8/lib/active_support/core_ext/object.rb:12:in `<top (required)>'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/configuration.rb:2:in `require'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/configuration.rb:2:in `<top (required)>'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/railtie.rb:2:in `require'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/railtie.rb:2:in `<top (required)>'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/engine.rb:1:in `require'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/engine.rb:1:in `<top (required)>'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/application.rb:7:in `require'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/application.rb:7:in `<top (required)>'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails.rb:11:in `require'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails.rb:11:in `<top (required)>'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/all.rb:1:in `require'
/usr/local/share/gems/gems/railties-4.2.8/lib/rails/all.rb:1:in `<top (required)>'
/var/www/html/redmine/config/application.rb:3:in `require'
/var/www/html/redmine/config/application.rb:3:in `<top (required)>'
/var/www/html/redmine/Rakefile:5:in `require'
/var/www/html/redmine/Rakefile:5:in `<top (required)>'
/usr/local/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/cli/exec.rb:74:in `load'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/cli/exec.rb:27:in `run'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/cli.rb:335:in `exec'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/cli.rb:20:in `dispatch'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/cli.rb:11:in `start'
/usr/local/share/gems/gems/bundler-1.14.5/exe/bundle:32:in `block in <top (required)>'
/usr/local/share/gems/gems/bundler-1.14.5/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/usr/local/share/gems/gems/bundler-1.14.5/exe/bundle:24:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
(See full trace by running task with --trace)

I have to add
gem "json"
before
gem "rails", "4.2.8"
to make it work again.

Actions #6

Updated by Holger Just about 7 years ago

Ruby since version 1.9.2 ships with a version of the json gem in its standard library. As such, it shouldn't be necessary to explicitly load an external JSON gem just for the functionality (there are other reasons why this still might be a good idea sometimes)

That said, some Ruby packagers (including CentOS), apparently decided to slim down their packaged Rubies to not ship the full standard library. In this case, it might be necessary to install additional packages to get the complete standard library. As such, check with your package manager how to get a complete standard library. If this is not available, you might also chose to open a bug on your Distribution's bug tracking system.

Alternatively, you could also chose to install Ruby using a ruby version manager such as RVM, rbenv, or similar, to install a complete Ruby package independent from your operating system.

Actions #7

Updated by ChunChang (Nagaharu) Lo over 6 years ago

This issue should be closed. After upgrading to newer ruby with rvm, the error no longer exists.
Thanks a lot.

Actions #8

Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Invalid

Thank you for your feedback.

Actions

Also available in: Atom PDF