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

てしりこじり

しりがちいさいエンジニアがいるという

Amazon Linux で bundle が cannot load such file -- io/console (LoadError) となる

bundle を実行しようとしたらエラーとなった

$ bundle -v
/usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError)
        from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>'
        from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/ui/shell.rb:14:in `initialize'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/cli.rb:12:in `new'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/cli.rb:12:in `rescue in start'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/cli.rb:10:in `start'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/exe/bundle:19:in `block in <top (required)>'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
        from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.11.2/exe/bundle:17:in `<top (required)>'
        from /home/ec2-user/bin/bundle:23:in `load'
        from /home/ec2-user/bin/bundle:23:in `<main>'

調べてみたところ、 ruby-devel か io/console のインストールが怪しそう。

ruby-devel から対応してみる。

$ sudo yum install -y ruby-devel
読み込んだプラグイン:priorities, update-motd, upgrade-helper
amzn-main/latest                                                                                                                                                                                                                                                                                     | 2.1 kB     00:00
amzn-updates/latest                                                                                                                                                                                                                                                                                  | 2.3 kB     00:00
treasuredata/x86_64                                                                                                                                                                                                                                                                                  | 2.5 kB     00:00
パッケージ 1:ruby-devel-2.0-0.3.amzn1.noarch はインストール済みか最新バージョンです
何もしません

最新だ。io-consoleを入れてみる。

$ gem install io-console
Fetching: io-console-0.4.5.gem (100%)
Building native extensions.  This could take a while...
Successfully installed io-console-0.4.5
Parsing documentation for io-console-0.4.5
Installing ri documentation for io-console-0.4.5
Done installing documentation for io-console after 0 seconds
1 gem installed

動いた。

$ bundle -v
Bundler version 1.11.2