轨道上的红宝石"warning: shebang line ending with r may cause problems"在尝试修复后仍然发生



我克隆了一个应用chatwoot github https://github.com/chatwoot/chatwoot的存储库,然后在执行"rails "时遇到了这个警告;Windows WSL (ubuntu):

/home/user/.rbenv/versions/3.0.2/bin/ruby: warning: shebang line ending with r may cause problems

所以,我发现修改git配置(遵循这篇文章的第一个解决方案)会自动处理这个问题,但是在我尝试了之后,它仍然显示和上面一样。https://stackoverflow.com/a/54288670/18770801

command I trying:

git config --global core.autocrlf true

服务器不抛出任何错误(只是显示警告),但我不确定是否有办法摆脱该消息?

==============================================================

最后,当我按照项目设置指南foreman start -f Procfile.dev

时,我遇到了这个问题https://www.chatwoot.com/docs/contributing-guide/project-setup

17:13:40 backend.1  | started with pid 8482
17:13:40 frontend.1 | started with pid 8483
17:13:40 worker.1   | started with pid 8484
17:13:41 backend.1  | /usr/bin/env: ‘rubyr’: No such file or directory
17:13:41 backend.1  | exited with code 127
17:13:41 system     | sending SIGTERM to all processes
17:13:41 frontend.1 | terminated by SIGTERM
17:13:41 worker.1   | terminated by SIGTERM

我猜它可能来自同一个问题,但我不知道如何解决。如果有人能弄明白,请帮忙。

回答我自己的问题:

我试着解决这个问题,试错了好几次,因为我根本找不到任何可以解决我问题的答案。

在我的情况下,我克隆了Windows系统上的存储库(我设备上的每个文件都位于"C"驱动器)。这是在wsl (ubuntu)上运行时导致行尾格式问题的原因。当我试图运行脚本foreman start -f Procfile.dev来启动服务器时,出现了这个问题。然后抛出一个错误,它找不到' rubyr '。

这个问题来自Procfile.dev的指令行,它使用了bin/railsbin/webpack-dev-server文件。

要解决这个问题,使用vs code打开项目。在bin/railsbin/webpack-dev-server文件下,点击屏幕右下角的CRLF格式,将其更改为LF格式。这将转换为"CRLF"Windows的行尾格式("rn")为"LF"Linux的格式("n")。保存这两个文件并再次执行foreman start -f Procfile.dev重启服务器,问题就解决了。

最新更新