【问题标题】:Error: Installing vagrant gem in ruby 2.0.0错误:在 ruby​​ 2.0.0 中安装 vagrant gem
【发布时间】:2013-03-07 16:56:54
【问题描述】:

当我尝试在 ruby 2.0.0-p0 中安装 vagrant gem 时,出现以下错误:

~ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
~ gem -v
2.0.0.rc.2
~ gem list json
*** LOCAL GEMS ***
json (1.7.7)

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

    /home/user_name/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for ruby/re.h... yes
checking for ruby/encoding.h... yes
creating Makefile
make
compiling generator.c
generator.c: In function ‘cState_aref’:
generator.c:736:5: warning: variable ‘state’ set but not used [-Wunused-but-set-variable]
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/json/ext
/usr/bin/install: cannot create regular file `/home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/json/ext': No such file or directory
make: *** [install-so] Error 1
Gem files will remain installed in /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5 for inspection.
Results logged to /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/generator/gem_make.out

我想,它在构建 gem 时使用来自 /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/ 的 json-1.5.5 并出现上述错误.

我尝试重新安装最新的 json-1.7.7 gem,但仍然无法安装。

【问题讨论】:

    标签: ruby rubygems gem vagrant ruby-2.0


    【解决方案1】:

    将您的 ruby​​gems 更新为:gem update --system

    这是修复此问题的提交:https://github.com/rubygems/rubygems/commit/1ca11d00833bbca33215ff581303d1fee8f2d1ef

    【讨论】:

    • 谢谢,我最近安装了 ruby​​-2.0.0,并假设它使用的是最新的 ruby​​gem。通过此更新,vagrant 及其依赖项(包括 json 1.5.5)已成功安装。
    • 我正在使用 ruby​​-2.0.0-p0(与 RVM 一起安装)、MonngoDB 2.3.3 和 gem 2.0.0.rc.2 但它不工作...
    猜你喜欢
    • 2013-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-09
    • 2012-07-04
    相关资源
    最近更新 更多