linux - gradlew 错误 :/usr/bin/env: bash: No such file or directory

标签 linux git bash gradlew

使用 Git 将我的项目的 gradlew 文件从我的 Windows 机器提交到远程仓库后,在我的 Linux 服务器上调用 gradlew 失败并显示以下消息:

/usr/bin/env: bash: No such file or directory

发生了什么?

最佳答案

问题的原因是 Windows 上的 Git 将 gradlew 的行尾从 Unix 样式 (LF) 转换为 Windows 样式 (CRLF)。

您可以使用 git config core.autocrlf false 关闭自动转换。

gradlew 的行尾设置回 Unix 样式解决了这个问题。在 Vim这是使用 :set fileformat=unix 完成的。

关于linux - gradlew 错误 :/usr/bin/env: bash: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22301956/

相关文章:

sql - 从 mysql.sql 转储文件中提取表

linux - 迁移到新的 cvs 服务器时没有这样的存储库

node.js - mkdir 在 linux 上的 npm 脚本中不工作,但在 mac 上工作

regex - Bash shell - 从保存在字符串中的文件夹中提取目录名

java - 为什么 FileSystemXmlApplicationContext 在存在的文件上抛出 FileNotFoundException

linux - 如何在 bash 脚本中执行此操作

windows - Git 状态需要很长时间才能完成

git - 在当前标准布局和过去非标准布局的项目中 git-svn 使用哪种布局

Git post-receive hook 和环境变量

python - 如何正确地将 Python 脚本输出重定向到文件?