我只是在我的 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
从那时起,我真的不知道该怎么办。我试图在网上寻找类似的错误和解决方案,但没有任何帮助,我仍然收到此错误。
有没有办法解决它,如果有,你能告诉我一步一步怎么做吗?