我是Play框架的初学者.我只是提取Play框架文件并提取它们,并在$PATH全局变量中给出了播放目录的路径.在此之后,当我在ubuntu播放帮助上运行命令时,它给出了以下错误:
/usr/bin/env: sh: No such file or directory
Run Code Online (Sandbox Code Playgroud)
有什么线索我为什么会遇到这个错误以及如何解决它?
Bab*_*emi 59
如果脚本具有Windows行结尾而不是unix行结尾,则通常会发生此错误.
尝试在脚本上运行dos2unix并尝试再次运行命令以查看是否收到相同的错误.
dos2unix [filename]
Run Code Online (Sandbox Code Playgroud)
要解决env: sh\r: No such file or directory问题:
有时,当文件在不同操作系统之间传输时,行结尾可能会转换为错误的格式,这可能会导致 shell 脚本出现问题。在受影响的文件上运行 dos2unix 是一种快速而简单的方法,可以修复行结束格式并确保 shell 脚本可以无错误地执行。
就我而言,这是从 Windows 转移到 MacOS。
这帮助了我:
brew install dos2unix.sh存储库中的所有文件:find . -type f -name '*.sh' -exec dos2unix {} \;dos2unix .husky/pre-commit希望它能帮助你。
只需使用此链接将 sh 终端更改为 bash ,一切都会好起来的。
1. Change user entry in /etc/passwd
a) edit /etc/passwd using any editor
$ vi /etc/passwd
b) find the line that belongs to the user (foo) that we about to modify
foo:x:1001:1001::/home/foo:/bin/sh
c) change from /bin/sh to /bin/bash
foo:x:1001:1001::/home/foo:/bin/bash
d) save
e) Logout and login back
2. Use chsh command
a) type chsh
$ chsh
b) You will be asked for password. Enter your password
c) This screen will appear
Enter the new value, or press ENTER for the default
Login Shell [/bin/sh]:
d) Put /bin/bash at the menu and press Enter
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
32260 次 |
| 最近记录: |