2016-09-20 37 views
2

私は最近、私の現在のシステムでrails3.xと一緒にrails5を使うためにrvmをインストールしました。私は新しいrails5アプリケーションを作成しようとしたとき、私は以下のエラーにRails - mysql2のインストールエラー

Could not find proper version of railties (3.2.13) in any of the sources 
Run `bundle install` to install missing gems. 

を持っていると私はやるしようとすると、バンドルをインストール、私はかなりいくつかのためにこれで捕まってしまった。この

gem install mysql2 -v '0.3.11' 
Building native extensions. This could take a while... 
/home/himanth/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:73: warning:  Insecure world writable dir /home/himanth/.rvm/gems in PATH, mode 040777 
ERROR: Error installing mysql2: 
ERROR: Failed to build gem native extension. 

/home/himanth/.rvm/rubies/ruby-2.3.1/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... no 
checking for rb_wait_for_single_fd()... yes 
checking for mysql.h... yes 
checking for errmsg.h... yes 
checking for mysqld_error.h... yes 
creating Makefile 

make "DESTDIR=" clean 

make "DESTDIR=" 
compiling mysql2_ext.c 
In file included from ./client.h:11:0, 
      from ./mysql2_ext.h:39, 
      from mysql2_ext.c:1: 
/home/himanth/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp] 
In file included from ./mysql2_ext.h:39:0, 
      from mysql2_ext.c:1: 
./client.h: In function 'rb_thread_blocking_region': 
./client.h:23:3: error: 'TRAP_BEG' undeclared (first use in this function) 
./client.h:23:3: note: each undeclared identifier is reported only once for each function it appears in 
./client.h:25:3: error: 'TRAP_END' undeclared (first use in this function) 
mysql2_ext.c: At top level: 
./client.h:16:1: warning: 'rb_thread_blocking_region' defined but not used [-Wunused-function] 
make: *** [mysql2_ext.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in /home/himanth/.rvm/gems/[email protected]/gems/mysql2-0.3.11 for inspection. 
Results logged to /home/himanth/.rvm/gems/[email protected]/extensions/x86_64-linux/2.3.0/mysql2-0.3.11/gem_make.out 

An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. 
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling. 

で捕まってしまいました時間があれば、どんな助けでも大歓迎です。ターミナル試してから

+0

をMySQLサーバ

sudo apt-get install mysql-client libmysqlclient-dev 

をインストールしようとした後

gem install rails 

を、 gem 'mysql2'、 '〜> 0.3.18' – Navin

+0

私は試してみるとプロジェクトの作成も完了しませんでした新しいプロジェクトを作成すると、このエラーが発生します。 ソースのどれかでrailties(3.2.13)の適切なバージョンを見つけることができませんでした。 不足している宝石をインストールするには 'bundle install'を実行してください。 どちらが混乱していますか。 –

+0

RVMはルビーバージョン用で、レールバージョン用ではありません。システムレベルでレール3とレール5の両方の宝石をインストールした場合は、新しいレールを実行する際に、使用するレールのバージョンをシステムに教える必要があります(http://stackoverflow.com/a/452458/385532) – Matt

答えて

0

次のUbuntuの場合

:Macの場合

sudo apt-get install mysql-client libmysqlclient-dev 
sudo gem install mysql2 

brew install mysql 
sudo gem install mysql2 
-1

あなたはあなたの新しいgemset

まずレールを取り付けるにレールをインストールしていませんコマンド付きgem install rails

その後、以下試してくださいbundle install

0

を実行します。あなたのgemfileでこれを置くために、バンドルをインストールしないこと、その後bundle install

関連する問題