【问题标题】:Run Ruby-generated `foreman` in GitBash, Windows 7在 Windows 7 的 GitBash 中运行 Ruby 生成的“工头”
【发布时间】:2014-10-05 18:51:34
【问题描述】:

我正在尝试在我的 GitBash (Windows 7) 中运行 foreman

我将它安装为 Heroku-Toolbelt for Windows 的一部分,并将 C:\Program Files (x86)\Heroku\ruby-1.9.3\bin 添加到路径中。它可以在 cmd 中运行,但这会扰乱我的工作流程。

我得到的错误...

$ foreman
sh.exe": /c/PROGRA~2/Heroku/RUBY-1~1.3/bin/foreman: "C:/Program: bad interpreter
: No such file or directory

我发现的问题是在工头里面的 HashBang 行...

#!"C:/Program Files (x86)/Heroku/ruby-1.9.3/bin/ruby.exe"
#
# This file was generated by RubyGems.
#
# The application 'foreman' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/
    version = $1
    ARGV.shift
  end
end

gem 'foreman', version
load Gem.bin_path('foreman', 'foreman', version)

HashBang 行无法正确解析为 Ruby 可执行文件,因为 C:/Program Files (x86)/...

中有空格

我试过用 '\' 转义空格,我试过添加额外的 "s。我不知所措。 如何解决 HashBang 行?

PS:问的第一个问题,不确定我是否“询问”了 StackFlow 标准,感谢您的帮助

【问题讨论】:

    标签: ruby windows command-line-interface git-bash heroku-toolbelt


    【解决方案1】:

    所以,我在 StackOverflow 上找到了答案 - 是的,我在发布之前确实看过:P

    在此回复来源: Foreman installed by heroku toolbelt on windows can't be found

    我的总结:

    1. 要让 foreman 在 GitBash 中工作,您必须在包含 无空格 的文件夹中安装 heroku-toolbelt - 我使用了 C:\Heroku

    然后是我还没有遇到的问题的答案! 要使 forman 实际工作,您必须恢复到旧版本,准确地说是 v0.61**。所以...

    gem uninstall foreman && gem install foreman -v 0.61
    

    成功了,它现在对我有用!耶!

    **安装在我的 heroku-toolbelt 上的工头版本是 v0.74

    【讨论】:

      猜你喜欢
      • 2014-02-02
      • 2019-05-26
      • 1970-01-01
      • 1970-01-01
      • 2018-08-06
      • 2018-05-17
      • 2012-03-09
      • 2013-07-18
      • 2014-01-25
      相关资源
      最近更新 更多