我将Mac OSX版本更改为Lion。但是我无法创建Rails3应用程序。
我使用 rvm 1.9.2,并选择 ruby 1.9.2-p290 来创建 Rails 3 应用程序。
一切似乎都很糟糕。当我开始创建新应用程序时
rails new new_my_app
我看到这个错误,
Installing json (1.6.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/ender/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6 for inspection.
Results logged to /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.6.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.6'` succeeds before bundling.
当我尝试时
gem install json -v '1.6.6'
我面临这个错误
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/ender/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6 for inspection.
Results logged to /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6/ext/json/ext/generator/gem_make.out
我应该怎么做才能解决这个问题?
谢谢。
您需要从 Lon 的 Xcode 4 中的首选项安装"命令行工具"。
你需要安装 osx-gcc-installer
如果您从 previoys 系统迁移了 ruby,则需要重新安装 ruby 和 gems:
rvm reinstall 1.9.2
rvm use 1.9.2
rvm gemset pristine
我遇到了这个问题,这为我解决了它。我最近从旧系统迁移到新的 iMac。
我首先安装了libksba。我不确定是否有必要,但我想这不会伤害。我使用自制软件,所以我就是这样做的:
brew install libksba
然后,我更新了 rvm。
rvm get head
更新后,它告诉我我需要安装 ruby-1.9.3-p194。
rvm install ruby-1.9.3-p194
安装了 1.9.3。我想要一些较旧的应用程序的 1.9.2,所以我重新安装了它。
rvm reinstall 1.9.2
最后,我安装了导致此问题的 json gem:
gem install json -v '1.6.6'
中提琴!它安装正确。我做的最后一件事是运行捆绑包,但它抱怨找不到这个:
Could not find multi_json-1.3.1 in any of the sources
我删除了 Gemfile.lock 并重新运行捆绑包。
rm Gemfile.lock
bundle
现在一切正常!
最后我赢了。也许这可能是简短或简单的方法。你知道的。首先,我更新了RVM,但在此之前,我从Lion的appstore安装了Xcode 4。第二步是重新安装最新的稳定红宝石版本并创建我的宝石集。最后,我将 rails 3.2 下载到我之前在 ruby 上设置的宝石组。