gem install rails 中に Installing ri documentation for actionpack-4.2.0 が ERROR: While executing gem … (Errno::EINVAL) となった場合の対策方法

環境

Windows 7 Ultimate edition 64bit
ruby 2.0.0p598 (2014-11-13) [i386-mingw32]
gem 2.0.14
Rails 4.2.0

問題

Installing ri documentation for actionpack-4.2.0
ERROR: While executing gem … (Errno::EINVAL)
Invalid argument – ./ActionDispatch/Routing/Mapper/Scoping/:

詳細

gem install rails を実行中に発生する。

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\daisuke>gem install rails
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.5.1.gem (100%)
Successfully installed minitest-5.5.1
Fetching: activesupport-4.2.0.gem (100%)
Successfully installed activesupport-4.2.0
Fetching: loofah-2.0.1.gem (100%)
Successfully installed loofah-2.0.1
Fetching: rails-html-sanitizer-1.0.1.gem (100%)
Successfully installed rails-html-sanitizer-1.0.1
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching: rails-dom-testing-1.0.5.gem (100%)
Successfully installed rails-dom-testing-1.0.5
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: actionview-4.2.0.gem (100%)
Successfully installed actionview-4.2.0
Fetching: actionpack-4.2.0.gem (100%)
Successfully installed actionpack-4.2.0
Fetching: activemodel-4.2.0.gem (100%)
Successfully installed activemodel-4.2.0
Fetching: arel-6.0.0.gem (100%)
Successfully installed arel-6.0.0
Fetching: activerecord-4.2.0.gem (100%)
Successfully installed activerecord-4.2.0
Fetching: globalid-0.3.0.gem (100%)
Successfully installed globalid-0.3.0
Fetching: activejob-4.2.0.gem (100%)
Successfully installed activejob-4.2.0
Fetching: mail-2.6.3.gem (100%)
Successfully installed mail-2.6.3
Fetching: actionmailer-4.2.0.gem (100%)
Successfully installed actionmailer-4.2.0
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: railties-4.2.0.gem (100%)
Successfully installed railties-4.2.0
Fetching: bundler-1.7.12.gem (100%)
Successfully installed bundler-1.7.12
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: sprockets-2.12.3.gem (100%)
Successfully installed sprockets-2.12.3
Fetching: sprockets-rails-2.2.4.gem (100%)
Successfully installed sprockets-rails-2.2.4
Fetching: rails-4.2.0.gem (100%)
Successfully installed rails-4.2.0
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for thread_safe-0.3.4
Installing ri documentation for thread_safe-0.3.4
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for minitest-5.5.1
Installing ri documentation for minitest-5.5.1
Parsing documentation for activesupport-4.2.0
unable to convert "\x84" from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping
Installing ri documentation for activesupport-4.2.0
Parsing documentation for loofah-2.0.1
Installing ri documentation for loofah-2.0.1
Parsing documentation for rails-html-sanitizer-1.0.1
Installing ri documentation for rails-html-sanitizer-1.0.1
Parsing documentation for rails-deprecated_sanitizer-1.0.3
Installing ri documentation for rails-deprecated_sanitizer-1.0.3
Parsing documentation for rails-dom-testing-1.0.5
Installing ri documentation for rails-dom-testing-1.0.5
Parsing documentation for builder-3.2.2
Installing ri documentation for builder-3.2.2
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for actionview-4.2.0
Installing ri documentation for actionview-4.2.0
Parsing documentation for actionpack-4.2.0
Installing ri documentation for actionpack-4.2.0
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - ./ActionDispatch/Routing/Mapper/Scoping/:

対処方法

gem install rdocを実行してから再度 gem install rails をするだけでOKでした。
ruby のバージョンが 1.8.7 または 1.9.1 の場合は gem install rdoc-data; rdoc-data –install とする必要があるようです。

C:\Users\daisuke>gem install rdoc
Fetching: rdoc-4.2.0.gem (100%)
rdoc's executable "rdoc" conflicts with C:/Ruby200/bin/rdoc
Overwrite the executable? [yN]  y
rdoc's executable "ri" conflicts with C:/Ruby200/bin/ri
Overwrite the executable? [yN]  y
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed rdoc-4.2.0
Parsing documentation for rdoc-4.2.0
Installing ri documentation for rdoc-4.2.0
1 gem installed

C:\Users\daisuke>gem install rails
Successfully installed rails-4.2.0
Parsing documentation for rails-4.2.0
Installing ri documentation for rails-4.2.0
Done installing documentation for rails after 930 seconds
1 gem installed

参考情報

Stackoverflow – How do I fix an (Errno::EINVAL) error when installing rails 3?

スポンサーリンク