読者です 読者をやめる 読者になる 読者になる

`require': cannot load such file -- json/pure (LoadError)

bundler のインストールに失敗したので、対処方法をメモおく。

 

作業環境
- OS: CentOS Linux release 7.1.1503 (Core)
- Ruby: 2.2.0
- Rails: 4.2.3
- gem: 2.4.8

 

ERROR
# gem install bundler
Successfully installed bundler-1.10.5
/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- json/pure (LoadError)
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/gems/gems/json-1.7.7/lib/json.rb:60:in `rescue in '
        from /usr/share/gems/gems/json-1.7.7/lib/json.rb:57:in `'
        from /usr/share/gems/gems/json-1.7.7/lib/json.rb:54:in `'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/text.rb:16:in `'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/code_object.rb:28:in `'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/code_object.rb:26:in `'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/generator/markup.rb:59:in `'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/generator/darkfish.rb:6:in `'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rdoc.rb:563:in `'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:64:in `load_rdoc'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:229:in `setup'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:142:in `generate'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:54:in `block in generation_hook'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:53:in `each'
        from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:53:in `generation_hook'
        from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:188:in `call'
        from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:188:in `block in install'
        from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:187:in `each'
        from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:187:in `install'
        from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:249:in `install_gem'
        from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:299:in `block in install_gems'
        from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:295:in `each'
        from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:295:in `install_gems'
        from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:202:in `execute'
        from /usr/local/share/ruby/site_ruby/rubygems/command.rb:307:in `invoke_with_build_args'
        from /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:168:in `process_args'
        from /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:138:in `run'
        from /usr/local/share/ruby/site_ruby/rubygems/gem_runner.rb:54:in `run'
        from /bin/gem:21:in `
'

 

 

対処方法

json pureライブラリがインストールされていないことが原因でした。

# gem install json_pure
Fetching: json_pure-1.8.2.gem (100%)
Successfully installed json_pure-1.8.2
Parsing documentation for json_pure-1.8.2
Installing ri documentation for json_pure-1.8.2
1 gem installed

json pureのインストール後、bundlerをインストールできました。

# gem install bundler
Successfully installed bundler-1.10.5
Parsing documentation for bundler-1.10.5
Installing ri documentation for bundler-1.10.5
1 gem installed

 

 

以上、終わり