相关疑难解决方法(0)

当我尝试sudo gem install json时,我收到以下错误

我需要安装JSON gem来启动我的应用程序,但每当我尝试安装json gem时,我都会收到错误.谁能帮我吗.我正在使用rails 2.2.2和gem 1.3.1.

Arions-macbook-pro:.ssh arion$ sudo gem install json
Password:
Sorry, try again.
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install json
can't find header files for ruby.


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.1.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.1.4/ext/json/ext/parser/gem_make.out
Run Code Online (Sandbox Code Playgroud)

ruby macos json rubygems

30
推荐指数
3
解决办法
4万
查看次数

gem install mysql失败

我按照http://geryit.com/blog/2011/01/installing-mysql-with-rails-on-mac-os-x-snow-leopard/上的说明进行操作,包括通过macport安装ruby.

每当我执行gem install mysql时 ,我都会收到以下错误

bash-3.2# gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

        /opt/local/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** 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 …
Run Code Online (Sandbox Code Playgroud)

ruby mysql macos rubygems ruby-on-rails

11
推荐指数
5
解决办法
3万
查看次数

由于"mysql2"gem,我无法运行"bundle update"

我在Gemfile中有这个:

gem 'mysql2'
Run Code Online (Sandbox Code Playgroud)

但是当我运行bundle update时,我收到以下错误消息:

An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)

我试着把它移到生产部分,像这样:

group :production do
  gem 'mysql2'
end
Run Code Online (Sandbox Code Playgroud)

但是在运行bundle更新后,结果是一样的.此部分仅在生产模式下处理,或不处理?

如何摆脱localhost上的此错误消息?

编辑:整个错误消息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/radek/.rvm/rubies/ruby-1.9.3-p385/bin/ruby extconf.rb
checking for ruby/thread.h... *** 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. …
Run Code Online (Sandbox Code Playgroud)

ruby mysql gem ruby-on-rails gemfile

10
推荐指数
2
解决办法
1万
查看次数

如何让XAMPP的MySQL和Ruby on Rails在我的Mac上协同工作?

我在我的Mac机器上运行XAMPP的mysql和apache(10.6.4).我通常使用此设置进行PHP开发,但
现在我想从Ruby on Rails开始.

不幸的是我无法让mysql与RoR一起工作.我用XAMPP启动mysql服务器,当我执行"rake db:migrate"时,我得到了这个输出:

!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql
Run Code Online (Sandbox Code Playgroud)

MySQL是位于/ Applications/XAMPP/xamppfiles/bin和mysql的SOCKET是/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

因此我的database.yml文件如下所示:

development:
  adapter: mysql
  database: dbname
  username: dbuser
  password: dbpw
  socket: /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
Run Code Online (Sandbox Code Playgroud)

我不认为我需要做一个"宝石安装mysql"因为MySQL已经与XAMPP运行.无论如何我试过但它也失败了:

ERROR:  Error installing mysql:
  ERROR: Failed to build gem native extension.
Run Code Online (Sandbox Code Playgroud)

mysql xampp macos rubygems ruby-on-rails

8
推荐指数
2
解决办法
8371
查看次数

在mac上用rails3安装mysql2 gem的问题

 Installing mysql2 (0.2.6) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework  /Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6 for inspection.  
Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/ext/mysql2/gem_make.out
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `each'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `build_extensions'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:198:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' …
Run Code Online (Sandbox Code Playgroud)

mysql rubygems ruby-on-rails ruby-on-rails-3

3
推荐指数
1
解决办法
7151
查看次数

MySQL Ruby Gem安装问题

所以我知道之前已经问过这个问题,我已经查看了之前的所有答案,但仍然无法找到解决方案.希望你们都能提供帮助.

设置:我正在运行Mac OS X 10.6服务器.我已经在Web应用程序上使用了内置的MySQL安装,它运行良好.现在我正在尝试运行需要MySQL的RoR应用程序.

所以,每当我进入

gem install mysql
Run Code Online (Sandbox Code Playgroud)

它吐出以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/Users/admin/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb --with-mysql-config=/var/mysql
*** 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/admin/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
    --with-mysql-config
extconf.rb:35:in ``': …
Run Code Online (Sandbox Code Playgroud)

mysql macos ruby-on-rails osx-server ruby-on-rails-3

3
推荐指数
1
解决办法
8115
查看次数