我创建了一个新的 Rails API 应用程序。我正在尝试使用 postgres db 的命令为应用程序创建数据库表
rake db:create:all
我收到此错误:
AM@~/Documents/RailsWS/iosprototypevendors >rake db:create:all --trace
rake aborted!
Valid types are [:development, :runtime], not nil
/usr/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:52:in `initialize'
/Users/AM/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler- 1.2.0/lib/bundler/resolver.rb:371:in `new'
/Users/AM/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler- 1.2.0/lib/bundler/resolver.rb:371:in `search'
/Users/AM/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-
..............
一堆谷歌搜索我发现这可能与拾取的错误版本的红宝石有关。
(我最近将我的操作系统升级到 Mountain Lion 并且不得不将我的 Rails 和 Ruby 版本升级到最新版本。经历了 8 小时的地狱来让 Rails 正常运行。Rails 现在可以在我的系统上运行,但这是一个刚刚出现的差异)。
此外
我还注意到,对于我系统上的不同 Rails 应用程序,当我使用 rails -v 检查它们的版本时,rails 的版本有时会显示为 3.2.1,有时会显示为 3.2.8,有时我会收到上述错误消息。
这怎么会发生?这是我通过运行此命令得到的结果:
rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin A-Ms-MacBook-Pro.local 12.1.0 Darwin Kernel Version 12.1.0: Tue Aug 14 13:29:55 PDT 2012; root:xnu-2050.9.2~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.15.8 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 day 22 hours 15 minutes 59 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin12.1.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]"
homes:
gem: "/Users/AM/.rvm/gems/ruby-1.9.3-p194"
ruby: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/Users/AM/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"
environment:
PATH: "/Users/AM/.rvm/gems/ruby-1.9.3-p194/bin:/Users/AM/.rvm/gems/ruby- 1.9.3-p194@global/bin:/Users/AM/.rvm/rubies/ruby-1.9.3- p194/bin:/Users/AM/.rvm/bin:/Users/AM/.rbenv/shims:/Users/AM/.rbenv/bin:/usr/local/bin:/usr/ local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/PostgreSQL/9.1/bin/"
GEM_HOME: "/Users/AM/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/Users/AM/.rvm/gems/ruby-1.9.3-p194:/Users/AM/.rvm/gems/ruby-1.9.3-p194@global"
MY_RUBY_HOME: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
任何帮助表示赞赏
编辑
这是我运行命令时得到的
echo $PATH on my terminal
/Users/AM/.rbenv/shims:
/Users/AM/.rbenv/bin:
/usr/local/bin:/usr/local/sbin:
/usr/local/mysql/bin:
/Users/AM/.rvm/gems/ruby-1.9.3-p194/bin:
/Users/AM/.rvm/gems/ruby-1.9.3-p194@global/bin:
/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin:
/Users/AM/.rvm/bin:
/usr/local/bin:
/usr/bin:/usr/bin:
/bin:/usr/sbin:/sbin:
/usr/local/bin:
/Library/PostgreSQL/9.1/bin/
所以这些是我系统上的路径