env: ruby\r: 没有那个文件或目录 [英] env: ruby\r: No such file or directory
问题描述
我有 Rails 项目.当我尝试运行任何 rake 任务或 rails 服务器时,它给了我这个错误
I have Rails project. When I try to run any rake task or rails server it give me this error
env: ruby\r: 没有那个文件或目录
env: ruby\r: No such file or directory
有人可以帮我吗?
推荐答案
如果您在 Unix/Mac 上工作,则此错误是因为您的行尾不正确.
If you are working on a Unix / Mac, then this error is because you have incorrect line endings.
这是一个使用 dos2unix
的解决方案;您可能需要在您的系统上安装此程序.如果apt
可用,你可以使用sudo apt install dos2unix
.
Here is a solution using dos2unix
; you may need to install this program on your system. If apt
is available, you can use sudo apt install dos2unix
.
- 正确设置行尾,并让 git 管理如何处理它们:
git config --global core.autocrlf input
-
- 在您的目录中,您将通过运行以下命令转换所有文件:
find ./ -type f -exec dos2unix {} \;
这将遍历您的所有文件,并进行转换.并解决问题.添加您的更改.提交它们,你应该很高兴.
This will cycle through all of your files, converting them. and solving the problem. Add your changes. Commit them, and you should be good to go.
这篇关于env: ruby\r: 没有那个文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!