嘿,我尝试使用bundler和一些gems玩耍,现在我无法再使用rake
了。
如果我执行简单的db:migrate命令,就会出现以下错误:
mac:app antpaw$ rake db:migrate
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:335:in `bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
from <internal:gem_prelude>:282:in `method_missing'
from /usr/local/bin/rake:19:in `<main>'
如果我执行gem list
,rake会被列出。我使用Rails 3.0.0beta4、Bundler 1.0.0.beta.5和Ruby 1.9.2dev。
编辑我的export
已发布。
mac:trickpipe antpaw$ export
declare -x Apple_PubSub_Socket_Render="/tmp/launch-2GMaKT/Render"
declare -x COMMAND_MODE="unix2003"
declare -x DISPLAY="/tmp/launch-5RguhF/:0"
declare -x HOME="/Users/antpaw"
declare -x LC_CTYPE="UTF-8"
declare -x LOGNAME="antpaw"
declare -x OLDPWD="/Users/antpaw"
declare -x PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin"
declare -x PWD="/Volumes/Work HD/localhost/trickpipe"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/tmp/launch-N13Ivn/Listeners"
declare -x TERM="xterm-color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="272"
declare -x TMPDIR="/var/folders/-K/-Kf7svFPHrKmLqMXKAGLuU+++TI/-Tmp-/"
declare -x USER="antpaw"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:0:0"
mac:trickpipe antpaw$ which ruby
/usr/local/bin/ruby
mac:trickpipe antpaw$ ruby -v
ruby 1.9.2dev (2010-07-02 revision 28524) [x86_64-darwin10.2.0]
好的,我试过了,看看错误信息如何改变:
mac:trickpipe antpaw$ export GEM_HOME="/usr/local/lib/ruby/gems"
mac:trickpipe antpaw$ rake about
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:335:in `bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
from <internal:gem_prelude>:282:in `method_missing'
from /usr/local/bin/rake:19:in `<main>'
mac:trickpipe antpaw$ export GEM_PATH="/usr/local/lib/ruby/gems"
mac:trickpipe antpaw$ rake about
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rake (>= 0) (Gem::LoadError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:214:in `activate'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1082:in `gem'
from <internal:gem_prelude>:213:in `push_gem_version_on_load_path'
from <internal:gem_prelude>:16:in `gem'
from /usr/local/bin/rake:18:in `<main>'
mac:trickpipe antpaw$
现在使用rvm:
mac:trickpipe antpaw$ rake about
(in /Volumes/Work HD/localhost/rails_app)
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:30: warning: already initialized constant RAKEVERSION
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:402: warning: already initialized constant EMPTY_TASK_ARGS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:450: warning: already initialized constant EMPTY
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:958: warning: already initialized constant RUBY_EXT
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:962: warning: already initialized constant RUBY
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1031: warning: already initialized constant LN_SUPPORTED
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1240: warning: already initialized constant ARRAY_METHODS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1243: warning: already initialized constant MUST_DEFINE
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1247: warning: already initialized constant MUST_NOT_DEFINE
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1251: warning: already initialized constant SPECIAL_RETURN
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1257: warning: already initialized constant DELEGATING_METHODS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1561: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1567: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1604: warning: already initialized constant FileList
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1630: warning: already initialized constant EARLY
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1960: warning: already initialized constant DEFAULT_RAKEFILES
DEPRECATION WARNING: Calling a method in Rails::Application is deprecated, please call it directly in your application constant Trickpipe::Application. (called from method_missing at /Users/antpaw/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/rails-edb5401/railties/lib/rails/application.rb:77)
rake aborted!
stack level too deep
(See full trace by running task with --trace)