尝试在 Lion 上从 Foreman 运行 Node 时出现问题 - “exec”:权限被拒绝错误

发布于 2024-12-29 09:14:38 字数 4283 浏览 1 评论 0原文

我按照 Heroku 网站上的指南使用 foreman 运行节点服务器:

http://devcenter .heroku.com/articles/node-js

如果我直接加载它,我可以成功启动节点服务器,但是一旦我在Procfile中使用Foreman,就会出现以下错误......

My-MacBook-Air:myDirectory digiguru$ foreman start
13:25:26 web.1     | started with pid 29046
13:25:26 web.1     | /usr/local/foreman/lib/foreman/process.rb:38:in `exec': Permission denied - /usr/local/foreman/bin/runner (Errno::EACCES)
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:38:in `fork_with_io'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:32:in `fork'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:32:in `fork_with_io'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:44:in `run_process'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:19:in `run'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:64:in `with_environment'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:18:in `run'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:17:in `chdir'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:17:in `run'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/procfile_entry.rb:17:in `spawn'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/procfile_entry.rb:15:in `map'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/procfile_entry.rb:15:in `spawn'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:63:in `spawn_processes'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:61:in `each'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:61:in `spawn_processes'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:45:in `start'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/cli.rb:28:in `start'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
13:25:26 web.1     |    from /usr/bin/foreman:15
13:25:26 web.1     | process terminated
13:25:26 system    | sending SIGTERM to all processes

有什么问题吗?我能做的就是给福尔曼 允许?我尝试过 sudo foreman start ,但没有成功。

我正在 ruby​​ 版本 1.9.3 中运行(从默认安装在 lion 上的版本 1.8.7 升级)。

更新

@user658619从ruby gems安装heruko和foreman之后运行sudo foreman start,我们得到...

/Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find foreman (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
    from /Users/digiguru/.rvm/gems/ruby-1.9.3-p0/bin/foreman:18:in `<main>'

我的环境...

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-darwin11.2.0]
  - INSTALLATION DIRECTORY: /Users/digiguru/.rvm/gems/ruby-1.9.3-p0
  - RUBY EXECUTABLE: /Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/digiguru/.rvm/gems/ruby-1.9.3-p0/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-11
  - GEM PATHS:
     - /Users/digiguru/.rvm/gems/ruby-1.9.3-p0
     - /Users/digiguru/.rvm/gems/ruby-1.9.3-p0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

I've followed the guide on Heroku's website to get a node server running using foreman:

http://devcenter.heroku.com/articles/node-js

I can successfully start up the node server if I load it directly, but as soon as I use Foreman in the Procfile, it errors with the following...

My-MacBook-Air:myDirectory digiguru$ foreman start
13:25:26 web.1     | started with pid 29046
13:25:26 web.1     | /usr/local/foreman/lib/foreman/process.rb:38:in `exec': Permission denied - /usr/local/foreman/bin/runner (Errno::EACCES)
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:38:in `fork_with_io'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:32:in `fork'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:32:in `fork_with_io'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:44:in `run_process'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:19:in `run'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:64:in `with_environment'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:18:in `run'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:17:in `chdir'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/process.rb:17:in `run'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/procfile_entry.rb:17:in `spawn'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/procfile_entry.rb:15:in `map'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/procfile_entry.rb:15:in `spawn'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:63:in `spawn_processes'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:61:in `each'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:61:in `spawn_processes'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/engine.rb:45:in `start'
13:25:26 web.1     |    from /usr/local/foreman/lib/foreman/cli.rb:28:in `start'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
13:25:26 web.1     |    from /usr/local/foreman/vendor/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
13:25:26 web.1     |    from /usr/bin/foreman:15
13:25:26 web.1     | process terminated
13:25:26 system    | sending SIGTERM to all processes

Is there anything I can do to give Forman permission? I've tried sudo foreman start, but to no avail.

I am running in ruby version 1.9.3 (upgraded from version 1.8.7 installed on lion by default).

UPDATE

Running sudo foreman start after @user658619 installing heruko and foreman from ruby gems, we get...

/Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find foreman (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
    from /Users/digiguru/.rvm/gems/ruby-1.9.3-p0/bin/foreman:18:in `<main>'

My environment...

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-darwin11.2.0]
  - INSTALLATION DIRECTORY: /Users/digiguru/.rvm/gems/ruby-1.9.3-p0
  - RUBY EXECUTABLE: /Users/digiguru/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/digiguru/.rvm/gems/ruby-1.9.3-p0/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-11
  - GEM PATHS:
     - /Users/digiguru/.rvm/gems/ruby-1.9.3-p0
     - /Users/digiguru/.rvm/gems/ruby-1.9.3-p0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

悲念泪 2025-01-05 09:14:39

我今天也遇到了同样的问题。你是通过heroku-toolbelt.pkg安装heroku的吗?

尝试使用 gem 重新安装 heroku 和 foreman。

sudo gem install heroku foreman

I got the same problem today. Did you install heroku thru heroku-toolbelt.pkg??

Try use gem to reinstall heroku and foreman.

sudo gem install heroku foreman
长发绾君心 2025-01-05 09:14:39

基本上,为了让它工作,我不幸地混合了红宝石和宝石,搞砸了我的安装,其中一些需要 SUDO,一些则不需要。

幸运的是,互联网上的好心人已经用一个名为 RVM 的工具为您解决了这个问题

RVM 允许您使用自己的完全独立且专用的环境来部署每个项目 - 从特定版本的 ruby​​,一直到运行应用程序所需的一组精确的 gem。拥有一套精确的 gems 还可以避免项目之间的版本冲突问题,这可能会导致难以追踪的错误和数小时的脱发。

http://beginrescueend.com/

首先下载 RVM

$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

您需要打开一个新的执行此操作后的终端窗口。

清理。如果您安装了奇怪的宝石,您会想要将其删除。转到根目录并 sudo 删除它们。您可以使用gem list 命令

cd 
sudo gem list
sudo gem uninstall foreman heroku

安装 ruby​​ 查看所有这些。您应该在应用程序的子目录中执行此操作。我选择了 1.9.3

cd myApp
rvm install 1.9.3

添加您需要的任何宝石。对我来说,这只是工头和 Heroku。

cd myApp
gem install foreman heroku

似乎工作很愉快。

Basically to get it working I had unfortunatley mucked up my installations by having a mix of rubies and gems some of which required SUDO, some that didn't.

Fortunately the good people of the internet have solved this problem for you with a tool called RVM

RVM lets you deploy each project with its own completely self-contained and dedicated environment--from the specific version of ruby, all the way down to the precise set of required gems to run your application. Having a precise set of gems also avoids the issue of version conflicts between projects, which can cause difficult-to-trace errors and hours of hair loss.

http://beginrescueend.com/

First download RVM

$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

You'll want to open a new terminal window after doing this.

Clean up. If you have weirdly installed gems you'll want to remove them. Go to your root directory and sudo get rid of them. You can see all of them with the gem list command

cd 
sudo gem list
sudo gem uninstall foreman heroku

Install a ruby. You should do this in the subdirectory of your application. I chose 1.9.3

cd myApp
rvm install 1.9.3

Add any gems you need. For me that was just foreman and heroku.

cd myApp
gem install foreman heroku

Seemed to work a treat.

给妤﹃绝世温柔 2025-01-05 09:14:39

试试这个。在 Procfile 中,执行

web: node ./bin/www

Try this. In Procfile, do

web: node ./bin/www
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文