gpt4 book ai didi

ruby-on-rails - 将 Mac Pro 中的操作系统更新为 mavericks 后无法创建 Rails 应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 16:28:40 25 4
gpt4 key购买 nike

我刚刚将我的操作系统更新为 Mac 中的特立独行者。在更新我的操作系统之前,我在 Rails 中创建一个新项目时没有问题,但是现在,当我尝试创建一个新项目时出现错误。这就是我所做的:

tomers-MacBook-Pro:bootstrapProject tomerdoar$ rails new blog

我得到这个错误:

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

/Users/tomerdoar/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1


Gem files will remain installed in /Users/tomerdoar/.rvm/gems/ruby-1.9.3-p194/gems/json-1.8.1 for inspection.
Results logged to /Users/tomerdoar/.rvm/gems/ruby-1.9.3-p194/gems/json- 1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

然后,如其所说,我正在尝试安装 json -v '1.8.1'。我这样做:

tomers-MacBook-Pro:bootstrapProject tomerdoar$ gem install json -v '1.8.1'

我得到这个错误:

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

/Users/tomerdoar/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1


Gem files will remain installed in /Users/tomerdoar/.rvm/gems/ruby-1.9.3-p194/gems/json-1.8.1 for inspection.
Results logged to /Users/tomerdoar/.rvm/gems/ruby-1.9.3-p194/gems/json- 1.8.1/ext/json/ext/generator/gem_make.out

从那一刻起,我真的不知道该怎么办了。我试图在网上寻找类似的错误和解决方案,但没有任何帮助,我仍然遇到此错误。

有什么办法可以解决吗,如果有的话,你能告诉我一步一步怎么做吗?

最佳答案

我自己找到了答案,我必须执行这些步骤:

tomers-MacBook-Pro:bootstrapProject tomerdoar$brew tap homebrew/versions && brew install apple-gcc42

tomers-MacBook-Pro:bootstrapProject tomerdoar$brew link --force apple-gcc42

tomers-MacBook-Pro:bootstrapProject tomerdoar$ln -nsf $(which gcc-4.2) /usr/bin/gcc-4.2

我现在没有任何问题

关于ruby-on-rails - 将 Mac Pro 中的操作系统更新为 mavericks 后无法创建 Rails 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19940378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com