[Ruby on Rails]環境のトラブル:Railsがインストールされていないエラーについて

このQ&Aのポイント
  • 質問者は、Railsの環境構築に関する問題を経験しています。
  • 問題は、ターミナルで`rails server`コマンドを実行した際に、「Rails is not currently installed on this system」というエラーメッセージが表示されることです。
  • 質問者は、最新のRailsを複数回インストールしたにも関わらず、問題が解消されないと述べています。
回答を見る
  • ベストアンサー

[Ruby on Rails]環境

http://okwave.jp/qa/q8165452.html の質問のご回答有り難うございました。 ~/.bash_profileを一度消去することで、問題は一応解決しました。 Mac portsを用いて http://qiita.com/emadurandal/items/a60886152a4c99ce1017 の通りに事は進んだのですが、 一度ターミナルを終了しもう一度rails serverを立ち上げようとしたところ Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your "rails" command. というのが返ってきます。 何度も最新版をインストールしたのですが、これは反映されてないということですかね。 どうググっても的確なこたえにたどり着けずの状態です。 初心者で簡単な所を見落としているかもですが、どうかご回答宜しくお願いします。

質問者が選んだベストアンサー

  • ベストアンサー
  • ki073
  • ベストアンサー率77% (491/634)
回答No.2

ちょっと訂正です。 sudo select ruby ruby19 ではなくて sudo port select ruby ruby19 (もしくはruby20) でした。 補足しておきますと、 ~/.profileと~/.bash_profileは両方存在する場合には、source xxxxのようにしておかないと、片一方しか読まないはずです。記憶が正しければ~/.bash_profileだけ。 それと、PATHの設定で、優先順位が決まります。もし/opt/local/binが優先順位が高いと、そこにrubyを含めて残骸があると~/.rbenv/binが無視されます、そのあたりも考慮して見直してください。 まあ、rbenvを入れる前の状態にするのが簡単だと思いますが。

dorichan0629
質問者

お礼

ki073さん迅速にご丁寧な対応本当にありがとうございました。助かりました。

その他の回答 (1)

  • ki073
  • ベストアンサー率77% (491/634)
回答No.1

また墓穴を掘りましたね。 前の質問の回答欄No.5の通りやり、 sudo gem install rails で使えるようになるのですが、rbenvを入れてしまったのでしょうか?? 多分、MacPortsで入れたrailsやgemで/opt/local/binに入れたものと競合する可能性もあります。この辺を考慮することと、 ~/.profileに設定されていることと、~/.bash_profileとをうまく調整してやる必要があるかも知れません。 まあ、rbenvを入れる前の状態に戻して、MacPortsで入れたrubyでrailsをインストールしれば動くようになるはずです。 上記のことを自分で解決できないのでしたら、~/.bash_profile, ~/.bashrcが存在していたら削除、 ~/.rbenv(これはdirectoryのはず)も削除して、ruby19もしくはruby20をMacPortsでインストール、 sudo select ruby ruby19 でrubyを切り替え、 sudo gem install rails でいけるはずです。 もしMacPortsが動かないのでしたら、~/.profileを見直してください。 ~/.profileも削除して、/opt/localも削除してMacPortsを最初から入れた方が早いかもしれませんが。

関連するQ&A

  • Ruby on Rails のインストールについて

    『基礎 Ruby on Rails』という本を読んでいますが、 インストールできずに困っています(Macintosh使用者です)。 macportsをダウンロードして、 ターミナルでRubyとRubyGemsを入れました。 そのあと、 sudo gem install rails --version "~> 3.2.3" --no-rdoc --no-ri を実行するとつぎのエラーが表示されてできない状態です。 ERROR: Could not find a valid gem 'rails' (>= 0) in any repository ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNREFUSED: Connection refused - connect(2) (http://rubygems.org/latest_specs.4.8.gz) よろしくお願いします。

  • linuxにrailsのインストールができない。

    今CentOSにrailsをインストールしようとしているのですが、はまっています。 rubyはrvmでインストールできたので、gemでrailsをインストールしたのですが、 railsコマンドをうつと、「-bash: /usr/local/bin/rails: /usr/local/bin/ruby: bad interpreter: そのようなファイルやディレクトリはありません。」とでます。 これは昔railsを入れて、うまく動かなかったのでuninstallしたという経緯がある り、その設定ファイルがどこかにのこっているからだと思うのですが、でもrails のパスをどこにとおし直したらいいかわかりません(bash_profileかな?と思うのですが 、railsとうったときに何を参照していいいかわからない)。 何か気づいた点がありましたら、助言いただけると幸いです。

    • ベストアンサー
    • Ruby
  • rubygems, railsのインストール

    ruby on railsに詳しい方で分かる方がいればご教授いただきたいです。 先日までruby1.9.3, rails3.2.4を使用できていたのですが、他にいろんなものをインストールをしていた時に何か変になってしまったのか、突然railsが使用できなくなってしまいました。 OSはMac OS X 10.7.5です。 rails、gemの場所を調べるとopt/local/bin/となっているのですが、rails-vとすると -bash: /opt/local/bin/rails: /opt/local/bin/ruby: bad interpreter: No such file or directory gem -vとすると -bash: /opt/local/bin/gem: /opt/local/bin/ruby: bad interpreter: No such file or directory となってしまって使えません。しかしrubyは正常に動いているようです。 何か分かる方がいらっしゃいましたら、お力を貸して下さると非常に助かります。 作業ができずに困っています。どなたか、お願いします><

    • ベストアンサー
    • Ruby
  • Ruby on rails sqlite3のドライバ?のインストールが

    Ruby on rails sqlite3のドライバ?のインストールがうまくいかない。 「rubyinstaller-1.8.6-p398.exe」をインストールして、gemのアップデート、「sqlite-3_6_23_1.zip」「sqlitedll-3_6_23_1.zip」をインストール?して、gemでsqlite3のドライバをインストールをすると以下のような文章がでてうまくいきません。(xp sp3) You've installed the binary version of sqlite3-ruby. It was built using SQLite3 version 3.6.23.1. It's recommended to use the exact same version to avoid potential issues. At the time of building this gem, the necessary DLL files where available in the following download: ttp://www.sqlite.org/sqlitedll-3_6_23_1.zip You can put the sqlite3.dll available in this package in your Ruby bin directory, for example C:\Ruby\bin ============================================================================= Successfully installed sqlite3-ruby-1.3.1-x86-mingw32 1 gem installed Installing ri documentation for sqlite3-ruby-1.3.1-x86-mingw32... Enclosing class/module 'mSqlite3' for class Statement not known No definition for libversion Installing RDoc documentation for sqlite3-ruby-1.3.1-x86-mingw32... Enclosing class/module 'mSqlite3' for class Statement not known No definition for libversion ドライバのバージョンを下げたりしてみてもうまくいきません。 rubyは勉強している書籍にあわせて1.8.6を使っています。 何が問題なのでしょうか?

    • ベストアンサー
    • Ruby
  • scaffold

    Ruby on Rails に関して質問です。 scaffoldができません。 #rails rn2 -d mysql でrn2というDBができるのらしいですが、mysqlにログインしてDBを確認しても見つかりませんでした。 そもそも #ruby script/generate scaffold hogehoge name:string id:integer という記述を実行し、テーブルを作ろうとしていて、 「Missing the Rails 2.3.2 gem. Please `gem install -v=2.3.2 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.」 となった問題を解決しようとしています。 railsは2.3.2で入っているのにこのエラーメッセージが表示されました。 参考になるサイトを教えていただけると幸いです。 よろしくお願いします。

  • Ruby on Railsのインストールについて

    Ruby on Railsのインストールをしています。 そこで、gemのインストールまではいきついたのですが、RMagickのインストールに失敗します。 失敗時のログは以下です。 --------------------------------------------------------------------------------- [manabix]# gem install rmagick --no-ri --no-rdoc -v 2.12.2 Building native extensions. This could take a while... /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:46: warning: Insecure world writable dir /usr/local in PATH, mode 040777 ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... yes checking for ImageMagick version >= 6.3.5... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes checking for InitializeMagick() in -lMagickCore... no checking for InitializeMagick() in -lMagick... no Can't install RMagick 2.12.2. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby --with-MagickCorelib --without-MagickCorelib --with-Magicklib --without-Magicklib Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2/ext/RMagick/gem_make.out --------------------------------------------------------------------------------- どうすれば、うまくRMagickをインストールできますでしょうか?

  • Rails bootstrapの環境構築について

    Ruby on RailsでTwitter bootstrapを使用するための環境構築方法をご教授ください。 【環境】 Windows7 ruby 1.9.2 rails 3.2.3 『Gemfile』の一番下に gem 'twitter-bootstrap-rails' を追記して bundle install を実施すると下記エラーで止まります。 -------------------------------------------------------------------------------- $ bundle install Fetching gem metadata from https://rubygems.org/......... Using rake (0.9.2.2) Using i18n (0.6.0) Using multi_json (1.3.6) Using activesupport (3.2.3) Using builder (3.0.0) Using activemodel (3.2.3) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.1) Using rack-cache (1.2) Using rack-test (0.6.1) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.1.3) Using actionpack (3.2.3) Using mime-types (1.19) Using polyglot (0.3.3) Using treetop (1.4.10) Using mail (2.4.4) Using actionmailer (3.2.3) Using arel (3.0.2) Using tzinfo (0.3.33) Using activerecord (3.2.3) Using activeresource (3.2.3) Using bundler (1.1.5) Using coffee-script-source (1.3.3) Using execjs (1.4.0) Using coffee-script (2.2.0) Using rack-ssl (1.3.2) Using json (1.7.4) Using rdoc (3.12) Using thor (0.14.6) Using railties (3.2.3) Using coffee-rails (3.2.2) Using commonjs (0.2.6) Using jquery-rails (2.0.2) Using less (2.2.1) Using less-rails (2.2.3) Installing libv8 (3.3.10.4) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. c:/Ruby192/bin/ruby.exe extconf.rb *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=c:/Ruby192/bin/ruby Checking for Python...Unable to build libv8: Python not found! Gem files will remain installed in c:/Ruby192/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4 for inspection. Results logged to c:/Ruby192/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/ext/libv8/gem_make.ou -------------------------------------------------------------------------------- 自分で調べたところ『libv8』,『therubyracer』が影響している?ようですが、 自環境にlibv8,therubyracerをうまくインストールする事ができません。 こちらを解決したら、Twitterbootstrapが使えるようになるのかもよく分かってません。。。。 結果として、上記環境のRailsでTwitterbootstrapが使えるようにしたいです。 解決策がお分かりの方がいましたら、ご教授をお願い致します。

    • ベストアンサー
    • Ruby
  • Railsでのpaginateの方法

    Rails3.2.9でのpaginateがうまくいきません。 分かる方、御教示ください。 今のところ、下記の状態です。 (1)Ruby193/lib/ruby/gems/1.9.1/gemsの下に、mislav-will_paginate-2.3.11  をインストールした。 (2)Ruby193/rails/demand/Gemfileに gem 'mislav-will_paginate', '~> 2.3' を追加した。 (3)コマンドプロンプトで、>bundle installを実行 Using mislav-will_paginate (2.3.11)となっていることを確認 (4)app/controller/demandapps_controller.rb のdef indexの@demandapps = Demandapp.allを @demandapps = Demandapp.paginate(:page => params[:page], :per_page => 15) に変更 (5)app/views/demandappsのindex.html.erbの <table>~</table>の下に <%= will_paginate(@items) %> を追加。 この状態でWEBrickを動かすと、 NoMethodError in DemandappsController#index undefined method `paginate' for #<Class:0x3c0a218> app/controllers/demandapps_controller.rb:5:in `index' のエラーが出ます。paginateが認識されていないようなのですが、 この他にどこか設定しないといけない個所とかあるのでしょうか? よろしくお願い致します。

    • ベストアンサー
    • Ruby
  • Rubricks の環境を作ろうと思うのですが。。

    タイトルにあるとおりRubricks の環境を作ろうと思うのですが、、 Mongrel 1.1.2のインストール gem install mongrel -v 1.1.2 -y を行うと、 Building native extensions. This could take a while... ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError) ERROR: Failed to build gem native extension. ruby extconf.rb install mongrel -v 1.1.2 -y creating Makefile nmake 'nmake' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/fastthread-1.0 .1 for inspection. Results logged to c:/ruby/lib/ruby/gems/1.8/gems/fastthread-1.0.1/ext/fastthread /gem_make.out と言うエラーが表示されます。 どのように対処したらよいのか分かりません。 詳しい方、よろしくお願いします。。

    • ベストアンサー
    • Ruby
  • 「rails s」でサーバーが起動できないです。(

    railsにおいて「rails s」でサーバーが起動できないです。(以下エラー文あり) 正直、上記の件、原因がわからなく困っております。 必要な情報は都度教えて頂ければ追記致します。 railsのインストールは確認できております。 sqlite3のインストールもできております。 gemのアップデートなども試しました。 一通り、ネットで同じような症状がでた方のページを拝見し上記対策を行いましたが、 上手くいきませんでした・・・。 宜しくお願いいたします。 Usage: rails new APP_PATH [options] Options: -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: /Users/ryouhasegawa/.rbenv/versions/2.1.5/bin/ruby -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL) [--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install -G, [--skip-git], [--no-skip-git] # Skip .gitignore file [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files ・ ・ ・ Description: The 'rails new' command creates a new Rails application with a default directory structure and configuration at the path you specify. You can specify extra command-line arguments to be used every time 'rails new' runs in the .railsrc configuration file in your home directory. Note that the arguments specified in the .railsrc file don't affect the defaults values shown above in this help message. Example: rails new ~/Code/Ruby/weblog This generates a skeletal Rails installation in ~/Code/Ruby/weblog. See the README in the newly created application to get going.