我得到这个错误:找不到宝石 'mysql2 ..' 轨运行脚本时/生成支架命令
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
尝试时:
rails script/generate scaffold post title:string
我在Mac OSX上,轨道1.8.7,3.0
我得到这个错误:找不到宝石 'mysql2 ..' 轨运行脚本时/生成支架命令
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
尝试时:
rails script/generate scaffold post title:string
我在Mac OSX上,轨道1.8.7,3.0
您使用rails script/generate …
与rails 3.0?也许你升级了rails 2.x项目?使用导轨3时,应使用rails generate …
或更短的rails g …
。
关于失踪的宝石:运行bundle install
的要求:)
在Ubuntu,你可能需要对MySQL先安装库。
sudo apt-get install libmysqlclient-dev
然后你就可以安装
gem install mysql2
甚至更好的办法是使用rvm
rvm gem install mysql2
确定它的工作,我得到了在Ubuntu同样的错误和捆绑安装没有让它工作,但在我的Mac它工作表示感谢。 – Blankman 2010-09-22 02:01:37
在ubuntu上:试着简单地用'gem install mysql2'安装它,尝试更新gem system'gem update --system'并安装 – tig 2010-09-22 10:14:14