Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 由于JSON v(1.7.3)gem错误,无法在Mac OS Mountain Lion上运行捆绑安装_Ruby On Rails_Ruby_Json - Fatal编程技术网

Ruby on rails 由于JSON v(1.7.3)gem错误,无法在Mac OS Mountain Lion上运行捆绑安装

Ruby on rails 由于JSON v(1.7.3)gem错误,无法在Mac OS Mountain Lion上运行捆绑安装,ruby-on-rails,ruby,json,Ruby On Rails,Ruby,Json,首先,我在mac上安装了xcode的命令行工具,所以这不是问题所在。请不要把我引向其他50篇关于这一点的帖子,因为它们都说“安装命令行工具” 这是我在运行bundle安装时遇到的错误 Installing json (1.7.3) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/r

首先,我在mac上安装了xcode的命令行工具,所以这不是问题所在。请不要把我引向其他50篇关于这一点的帖子,因为它们都说“安装命令行工具”

这是我在运行
bundle安装时遇到的错误

Installing json (1.7.3) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
creating Makefile

make
compiling parser.c
make: gcc-4.2: No such file or directory
make: *** [parser.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/json-1.7.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
我已经到处找了,有人告诉我安装
installruby dev
命令,但我还没有找到mac解决方案,因为我没有安装
apt

此外,从错误的角度看,文件试图进入的地方似乎缺少一个目录。我甚至不知道该怎么办

我也没有找到完全重新安装ruby的方法

有什么简单的解决办法吗

非常感谢

编辑:这里是我的本地gems列表,我运行的是GCC版本4.2.1和Ruby版本1.9.3-p194

wierd的问题是已经安装了一个更新版本的JSON(1.7.5),所以我不知道它为什么要安装1.7.3,也许有一个gem具有依赖性?我希望我能跳过这个gem,安装包的其余部分。依赖关系应该在1.7.5中得到满足,除非gem需要特定的版本,对吗

*** LOCAL GEMS ***

actionmailer (3.2.13, 3.2.7, 3.2.6)
actionpack (3.2.13, 3.2.7, 3.2.6)
activemodel (3.2.13, 3.2.7, 3.2.6)
activerecord (3.2.13, 3.2.7, 3.2.6)
activeresource (3.2.13, 3.2.7, 3.2.6)
activesupport (3.2.13, 3.2.7, 3.2.6)
appscrolls (0.9.0, 0.8.4)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bourne (1.4.0, 1.2.1)
builder (3.2.0, 3.0.0)
bundler (1.3.4, 1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.1, 1.3.3)
comp_tree (1.1.3)
devise (2.2.3, 2.1.2)
draper (1.1.0)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (4.2.0)
factory_girl_rails (4.2.1)
hike (1.2.1)
i18n (0.6.4, 0.6.1, 0.6.0)
journey (1.0.4)
jquery-rails (2.2.1, 2.1.1, 2.0.2)
js-routes (0.8.7)
json (1.7.5)
mail (2.5.3, 2.4.4)
metaclass (0.0.1)
mime-types (1.21, 1.19)
mocha (0.13.3, 0.12.7)
multi_json (1.7.1, 1.3.6)
orm_adapter (0.4.0)
polyglot (0.3.3)
pure (0.2.2)
rack (1.5.2, 1.4.5, 1.4.1)
rack-cache (1.2)
rack-ssl (1.3.3, 1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.13, 3.2.7, 3.2.6)
railties (3.2.13, 3.2.7, 3.2.6)
rake (10.0.3, 0.9.2.2)
rdoc (4.0.0, 3.12)
request_store (1.0.5)
ruby_parser (3.1.2)
rubygems-bundler (1.1.1, 1.0.3)
rvm (1.11.3.6, 1.11.3.5)
sass (3.2.7, 3.2.1, 3.1.20)
sass-rails (3.2.6, 3.2.5)
sexp_processor (4.2.0)
shoulda (3.4.0)
shoulda-context (1.0.2)
shoulda-matchers (1.5.1, 1.5.0)
simple_form (2.1.0, 2.0.2)
sprockets (2.9.0, 2.2.2, 2.1.3)
sqlite3 (1.3.6)
state_machine (1.1.2)
thor (0.17.0, 0.16.0, 0.15.4)
tilt (1.3.6, 1.3.3)
treetop (1.4.12, 1.4.10)
tzinfo (0.3.37, 0.3.33)
uglifier (1.3.0, 1.2.7)
warden (1.2.1)

听起来你好像没有安装GCC。至少有三种方法可以实现:

  • 去应用商店。安装Xcode。然后,在Xcode中,选择Xcode>Preferences>Downloads并单击命令行工具旁边的install

  • 登录Apple开发者网站,转到并下载命令行工具磁盘映像。安装

  • 通过自制、macports或从头编译安装GCC


  • 太棒了,我现在正在安装自制软件,看看它是如何工作的。但是如果你说GCC应该与命令行工具一起安装,它没有,因为我已经从XCode的下载面板和Apple开发者网站上安装了它们,两种方式都没有运气。命令行工具确实安装了GCC-
    /usr/bin/GCC
    是指向
    llvm-GCC-4.2
    的符号链接。看起来json make脚本正在显式调用gcc-4.2。尝试将
    /usr/bin/gcc
    符号链接到
    /usr/bin/gcc-4.2
    。您安装了哪个
    xcode
    gcc
    版本?您是否尝试过更新您的
    json gem
    ?(当前版本是1.7.8)在此之前,我安装了GCC版本4.2.1。xcode需要升级到4.6.1吗?好的,xcode现在已经升级到4.6.1了,但是仍然没有运气。正如我所说,GCC是4.2.1版,这是最新的版本。