Rails Rails 使用 mysql 出现问题

xautjzd · 2012年12月17日 · 最后由 suchiva 回复于 2013年07月30日 · 6949 次阅读

当 rails new demo -d mysql 时,在 run bundle install 停留了一会儿,然后出现 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension mysql.h is missing. please check your installation of mysql and try again.

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. 于是乎我便开始运行 gem install mysql -v '0.3.11',接着出现:

ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

mysql.h is missing. please check your installation of mysql and try again.

*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Google 搜索之,发现网上很多人说需要安装 libmysqlclient-dev。于是我便 yum install libmysqlclient-dev.结果出现:

Loaded plugins: langpacks, presto, refresh-packagekit No package libmysqlclient-dev available

哪位能帮忙解决下么?看看到底是什么原因引起的

@huacnlee 请问能帮忙解决下么?我搜寻答案大半天了,一直没解决

sudo yum install libmysqlclient-devel

#2 楼 @huacnlee 我是 fedora,装软件是以 root 身份运行的。

@poshboytl 能否帮忙解决下这个问题呢

#4 楼 @xautjzd 安装软件的时候都是需要先更新软件源的,我用的是 ubuntu 不知道,fedora 是如何更新,更新完后再安装依赖,然后再安装 mysql

yum install mysql-devel

#6 楼 @wuwx 我现在用的 therubyracer(googel v8 embeded with ruby) js runtime environment,但我现在想换成 nodejs 的 js runtime environment,并且通过 node js 的源码包装了 nodejs,但我如何设置 rails 的默认 js 环境为 nodejs 呢

#7 楼 @xautjzd 有关 js 几个可选运行环境的问题我就没有关注过了……

#2 楼 @huacnlee 你好,请问如何将 nodejs 设置为默认的 js runtime environment,现在我 pc 上装了 nodejs,也装了 therubyracer

我也是出现类似问题!!!我的是 WIN 环境!求指点!

#10 楼 @suchiva windows 环境我也没配过,既然选择了 ruby,就选择了舍弃 windows 环境。

#11 楼 @xautjzd 现在很多环境了,避免不了碰到,我公司是 WIN,家里是 MAC~

需要 登录 后方可回复, 如果你还没有账号请 注册新账号