11

を実行するrails sと、次のようになります。

/Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/pg-0.13.2/lib/pg_ext.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Abort trap: 6

バージョン:

rails -v
Rails 3.2.1
ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0]

1.9.3を使用している場合、エラー メッセージに ruby​​ バージョン1.8.7が記載されているのはなぜですか?

4

3 に答える 3

3

同様の問題があり、何かを実行するとbundle execセグメンテーション違反が発生しました:

~/mayapp >bundle exec rake -T
/Users/rogermarlow/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]

Abort trap: 6

(1) 1.9.3p125 の代わりに 1.9.3p327 を使用することと、(2) 現在存在しないディレクトリを指す GEM_HOME 環境変数という 2 つの問題がありました。だから私のための修正は次のとおりでした:

~/myapp >rvm list

rvm rubies

=* ruby-1.9.3-p327 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

~/myapp >rvm install 1.9.3-p125
**snip**
~/myapp >rvm use 1.9.3-p125
Using /Users/rogermarlow/.rvm/gems/ruby-1.9.3-p125
Running /Users/rogermarlow/.rvm/hooks/after_use_maglev
~/myapp >echo $GEM_HOME
/Users/rogermarlow/.rvm/gems/ruby-1.9.3-p125
~/myapp ># you should check that the directory in $GEM_HOME exists, I had ...-p125@global which had been removed at some point
~/myapp >bundle install
**snip**

bundle execセグメンテーション違反だったものを試してください...

~/myapp >bundle exec rake -T
rake about                  # List versions of all Rails frameworks and the environment
rake assets:clean           # Remove compiled assets
rake assets:precompile      # Compile all the assets named in config.assets.precompile
**snip**
于 2013-01-20T11:00:18.333 に答える
1

古いプロジェクトをテストする前に ruby​​ 1.8.7 をインストールしていたので、現在の Rails プロジェクト フォルダーに切り替えました。そこには、gemset を 1.9.3@blabla に設定する .rvmrc ファイルがあります。 . Ruby と Rails のバージョンは正しかった (1.9.3、3.2.12) のですが、どうやら Postgres はまだ 1.8.7 を使用しようとしていたようです。あなたが言及したのと同じエラーがあります。

私の解決策:

1/ cd out of the current folder project with the .rvmrc file
2/ rvm use 1.9.3 --default

その後、現在の Rails プロジェクトに戻って bundle update pg を実行しました

于 2013-02-21T13:33:08.613 に答える