2012-06-21

CentOS5でRails3.2.6がgemで入らない!

ruby -v
>> ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
gem -v
>> 1.8.24
な環境で試してみたところ
gem install rails --no-ri --no-rdoc
>> ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: railties requires rake (>= 0.8.7), rack-ssl (~> 1.3.2), thor (< 2.0, >= 0.14.6), rdoc (~> 3.4); actionmailer requires mail (~> 2.4.4); activerecord requires arel (~> 3.0.2), tzinfo (~> 0.3.29); actionpack requires journey (~> 1.0.1), sprockets (~> 2.1.3), erubis (~> 2.7.0)
と怒られてしまいます。
そんなときはbundlerを使うと良いようです。
早速インストール
gem install bundler --no-ri --no-rdoc
railsをインストールするために設定ファイルを作成
cat <<"EOF" > Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.6'
EOF
そして、いざインストール実行!
bundle install
>> Fetching gem metadata from https://rubygems.org/.........
Installing rake (0.9.2.2)
Installing i18n (0.6.0)
Installing multi_json (1.3.6)
Installing activesupport (3.2.6)
Installing builder (3.0.0)
Installing activemodel (3.2.6)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.1)
Installing rack-cache (1.2)
Installing rack-test (0.6.1)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.1.3)
Installing actionpack (3.2.6)
Installing mime-types (1.19)
Installing polyglot (0.3.3)
Installing treetop (1.4.10)
Installing mail (2.4.4)
Installing actionmailer (3.2.6)
Installing arel (3.0.2)
Installing tzinfo (0.3.33)
Installing activerecord (3.2.6)
Installing activeresource (3.2.6)
Using bundler (1.1.4)
Installing json (1.7.3) with native extensions
Installing rack-ssl (1.3.2)
Installing rdoc (3.12)
Installing thor (0.15.3)
Installing railties (3.2.6)
Installing rails (3.2.6)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
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!
そして、確認
rails -v
>> Rails 3.2.6
はい、入りましたヾ(*・ω・)シ しかし、いざrakeコマンド実行してみると
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
な感じで怒られてしまいました(´・ω・`)
execjsとtherubyracerをインストールしてあげれば良いみたいなので
cat <<"EOF" >> Gemfile
gem 'execjs'
gem 'therubyracer'
EOF
として、bundle updateしてあげればrakeもちゃんと動きました。

0 件のコメント:

コメントを投稿