简体   繁体   中英

Ruby on Rails gem problem

I'm using Ruby on rails (RubyMine) and I try starting my project. Which tells me the error "Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)".

I've done sudo gem install mysql which gives me

"Error installing mysql: ERROR: Failed to build gem native extension. Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out "

What should I do?

You're probably missing the development headers for MySQL. Often this is shipped as an optional package to install. You may need to install mysql-dev or mysql-devel depending on your package manager.

You might also be missing a compiler, so check that you have the required dependencies for gem such as make and gcc .

You might be missing the Ruby development headers as well. On my Ubuntu 11.04 box I have the following aptitude package which is needed for native gem compilation:

ruby1.9.1-dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM