在RubyOnRails上创建第一个应用程序时出错

时间:2014-07-03 03:05:33

标签: ruby-on-rails installation osx-mavericks

我正在遵循书中的指示"使用Rails进行敏捷Web开发"。我已经将rails,ruby,sqlite3下载到运行Mavericks的MacBookPro上。

我现在正尝试使用命令

首次创建新应用程序
rails new demo

但收到以下错误

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for rb_integer_pack()... no
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling backup.c
compiling database.c
database.c:300:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling exception.c
compiling sqlite3.c
compiling statement.c
linking shared-object sqlite3/sqlite3_native.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [sqlite3_native.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /var/folders/pk/2wfx1lm90gzb2mnzsgkntf480000gp/T/bundler20140702-7691-10in5mk/sqlite3-1.3.9/gems/sqlite3-1.3.9 for inspection.
Results logged to /var/folders/pk/2wfx1lm90gzb2mnzsgkntf480000gp/T/bundler20140702-7691-10in5mk/sqlite3-1.3.9/extensions/universal-darwin-13/2.0.0/sqlite3-1.3.9/gem_make.out
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
         run  bundle exec spring binstub --all
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/resolver.rb:357:in `resolve': Could not find gem 'uglifier (>= 1.3.0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/resolver.rb:164:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/resolver.rb:129:in `resolve'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/definition.rb:203:in `resolve'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/definition.rb:133:in `specs'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/definition.rb:178:in `specs_for'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/definition.rb:167:in `requested_specs'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/environment.rb:18:in `requested_specs'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:13:in `setup'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler.rb:120:in `setup'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.3/lib/bundler/setup.rb:17:in `<top (required)>'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'

我已经研究了这个主题,并在不同的论坛上找到了不同的建议,但每一次,我仍然会得到同样的错误。任何建议都非常感谢......

1 个答案:

答案 0 :(得分:1)

看起来你的sqlite3 gem安装失败了。以下是我用于在mac中设置新的ruby环境的说明。

  1. 安装自制软件。使用自制软件,您可以使用类似命令安装sqlite3或mysql brew install sqlite3

  2. 安装rvm

  3. 使用rvm

  4. 安装ruby和rails