6

我最近从使用 Ubuntu 系统 Ruby 切换到使用 RVM。当我运行时foreman start,无论我的 Procfile 中的命令是什么,我都会收到一个未找到的错误。

我当前的 Procfile 是:

web: bundle exec unicorn -p $PORT -c ./unicorn.rb

所以错误是:

/home/timmillwood/.rvm/gems/ruby-1.9.3-p327/gems/foreman-0.60.2/bin/foreman-runner: 41: exec: bundle: not found

which foreman返回

/home/timmillwood/.rvm/gems/ruby-1.9.3-p327/bin/foreman

which bundle返回

/home/timmillwood/.rvm/gems/ruby-1.9.3-p327/bin/bundle

的输出rvm info是:

ruby-1.9.3-p327:

  system:
    uname:       "Linux ubuntu 3.5.0-19-generic #30-Ubuntu SMP Tue Nov 13 17:48:01 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "ubuntu/12.10/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.17.3 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "1 hour 10 minutes 26 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p327"
    date:         "2012-11-10"
    platform:     "x86_64-linux"
    patchlevel:   "2012-11-10 revision 37606"
    full_version: "ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]"

  homes:
    gem:          "/home/timmillwood/.rvm/gems/ruby-1.9.3-p327"
    ruby:         "/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327"

  binaries:
    ruby:         "/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327/bin/ruby"
    irb:          "/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327/bin/irb"
    gem:          "/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327/bin/gem"
    rake:         "/home/timmillwood/.rvm/gems/ruby-1.9.3-p327@global/bin/rake"

  environment:
    PATH:         "/home/timmillwood/.rvm/gems/ruby-1.9.3-p327/bin:/home/timmillwood/.rvm/gems/ruby-1.9.3-p327@global/bin:/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327/bin:/home/timmillwood/.rvm/bin:/usr/local/heroku/bin:/home/timmillwood/Support-Tools/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    GEM_HOME:     "/home/timmillwood/.rvm/gems/ruby-1.9.3-p327"
    GEM_PATH:     "/home/timmillwood/.rvm/gems/ruby-1.9.3-p327:/home/timmillwood/.rvm/gems/ruby-1.9.3-p327@global"
    MY_RUBY_HOME: "/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327"
    IRBRC:        "/home/timmillwood/.rvm/rubies/ruby-1.9.3-p327/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

我也尝试过使用 rbenv 来解决完全相同的问题。Foreman 工作得很好,我使用的是系统 ruby​​,但是我已经从 Ubuntu 中清除了这些,并且想要使用 RVM 或 rbenv,所以我可以运行 Ruby 1.9 和 1.8。

就好像工头找不到捆绑二进制文件一样。我可以运行bundle exec ruby web.rbruby web.rb运行一个 sinatra 应用程序,但这失败了,因为它没有像工头那样从 .env 加载我的环境变量。我可以使用 rack-env 加载我的 .env 文件,然后使用ruby web.rb但宁愿使用工头加载我的 sinatra 应用程序。

有什么想法有什么问题吗?

4

2 回答 2

12

Turns out I had PATH overridden in my .env file I generated via heroku config:pull. Deleting that line has solved the problem.

Thanks all, nothing to see here.

于 2012-12-17T15:07:44.500 回答
0

像你这样的接缝~/.profile可以覆盖PATH-> https://github.com/ddollar/foreman/blob/master/bin/foreman-runner#L37,确保没有PATH=...in~/.profile或任何其他文件加载它。

于 2012-12-16T23:20:07.713 回答