fzngagan
(Faizaan Gagan)
1
最近,我在 MacOS 上使用 binstubs 时遇到了错误。我的工作流完全依赖它们。
env: ruby\r: 没有那个文件或目录
看起来是行尾符出了问题?
我的临时解决方法是使用 ruby bin/unicorn 等命令。这样做时,我会收到警告:ruby: warning: shebang line ending with \r may cause problems(ruby:警告:以 \r 结尾的 shebang 行可能导致问题)。
任何指点都将非常有帮助。有什么想法吗,@david?
david
(David Taylor)
2
听起来你的 binstubs 文件不知何故出现了 Windows 风格的行尾符。也许你是在 Windows 上打开了这些文件?或者你的文本编辑器切换到了使用 Windows 风格的换行符?
运行 file bin/unicorn 会显示什么?我看到的输出是:
❯ file bin/unicorn
bin/unicorn: Ruby script text executable, ASCII text
如果我手动将行尾符改为 Windows 风格,就会看到和你一样的错误,并且 file 命令会显示:
❯ file bin/unicorn
bin/unicorn: Ruby script text, ASCII text, with CRLF line terminators
^^ 当文件处于这种损坏状态时,Git 中会显示差异,运行 git reset --hard 即可修复。
5 个赞