【发布时间】:2017-01-28 10:26:03
【问题描述】:
我最近安装了 rvm 以在我当前的系统中使用 rails5 和 rails3.x 版本。当我尝试创建新的 rails5 应用程序时,出现以下错误
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/ruby-2.3.1@rails5/gems/mysql2-0.3.11 for inspection.
Results logged to /home/himanth/.rvm/gems/ruby-2.3.1@rails5/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.
被这个问题困扰了很长一段时间,任何帮助将不胜感激。
【问题讨论】:
-
试着把它放到你的 gemfile 中并做 bundle install, gem 'mysql2', '~> 0.3.18'
-
我什至没有完成创建项目,当我尝试创建新项目时,出现此错误..在任何源中找不到正确版本的 railties (3.2.13) 运行
bundle install安装丢失的宝石。这令人困惑.. -
RVM 适用于 ruby 版本,而不是 rails 版本。如果您在系统级别安装了 rails 3 和 rails 5 gems,当您运行 rails new 时,您可能需要告诉您的系统要使用哪个 rails 版本 (stackoverflow.com/a/452458/385532)
-
是的,马特,我分别使用两个不同的 ruby 版本.. 1.9.3 和 2.3.1.. 当我切换到 rvm ruby 2.3.1 时,创建新的 gemset 并尝试创建新的应用程序,我是收到此错误
-
一旦我遇到同样的问题,stackoverflow.com/questions/27832120/… 为我工作。
标签: mysql ruby-on-rails ruby bundler