getting error /usr/bin/env: sh: No such file or directory when running command play

£可爱£侵袭症+ 提交于 2019-11-30 13:11:01

问题


I am a beginner on Play framework . I just extract Play framework files and extracted them and gave the path of play directory in $PATH global variable. After this when I run the the command on ubuntu play help, its giving me below error:

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

Any clue why I am facing this error and how to resolve it ?


回答1:


This error usually happens if the script has windows line endings instead of unix line endings.

Try running dos2unix on the script and try running your command again to see if you get the same error.

dos2unix [filename]



回答2:


I had the same problem, and resolved it using Notepad++, by clicking Edit -> EOL Conversion -> Unix and then save the file.




回答3:


$PATH environment variable is set in ~/.bashrc, ~/.bash_profile or ~/.profile.

source the relevant configuration file or start a new bash terminal should solve the problem.




回答4:


Just change the sh terminal to bash using this link and everything should be fine.

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


来源:https://stackoverflow.com/questions/18172405/getting-error-usr-bin-env-sh-no-such-file-or-directory-when-running-command-p

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!