繁体   English   中英

Rails不适用于Lion

[英]Rails does not work on Lion

我将Mac OSX版本更改为Lion。 但是我无法创建Rails3应用程序。

我使用rvm 1.9.2并选择ruby 1.9.2-p290来创建Rails 3 app。

一切似乎都很好。 当我开始创建一个新的应用程序

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

我该怎么做才能解决这个问题?

谢谢。

您需要从Xcode 4 for Lion中的首选项安装“命令行工具”。

您需要安装osx-gcc-installer

如果您从previoys系统迁移ruby,则需要重新安装ruby和gem:

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'

中提琴! 它安装正确。 我做的最后一件事是运行bundle,但它抱怨没有找到这个:

Could not find multi_json-1.3.1 in any of the sources

我删除了Gemfile.lock并重新运行了bundle。

rm Gemfile.lock
bundle

现在一切正常!

最后我赢了。 也许它可能是短暂或简单的方式。 你懂。 首先,我更新了RVM,但在此之前,我从appstore为Lion安装了Xcode 4。 第二步是重新安装最新的稳定ruby版本并创建我的gemset。 最后我将rails 3.2下载到我之前在ruby上设置的gem集。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM