Debian - /usr/bin/env: 'php\r': No such file or directory
You should convert the file with UNIX new line convention.
You have a DOS file, which has the extra \r
character before \n
, which is interpreted as a character in the command. So system will check the program php\r
and not php
, and so it fails.
tr -d '\15' < original_file > converted_file
should do the work (StackOverflow has many other methods and tricks)
env: bash\r: No such file or directory
The error message suggests that the script you're invoking has embedded \r
characters, which in turn suggests that it has Windows-style \r\n
line endings instead of the \n
-only line endings bash
expects.
As a quick fix, you can remove the \r
chars. as follows:
sed $'s/\r$//' ./install.sh > ./install.Unix.sh
Note: The $'...'
string is an ANSI-C quoted string supported in bash
, ksh
, and zsh
. It is used to ensure that the \r
expands to an actual CR character before sed
sees the script, because not all sed
implementations themselves support \r
as an escape sequence.
and then run
./install.Unix.sh --clang-completer
However, the larger question is why you've ended up with \r\n
-style files - most likely, other files are affected, too.
Perhaps you're running Git on Windows, where a typical configuration is to convert Unix-style \n
-only line breaks to Windows-style \r\n
line breaks on checking files out and re-converting to \n
-only line breaks on committing.
While this makes sense for development on Windows, it gets in the way of installation scenarios like these.
To make Git check out files with Unix-style file endings on Windows - at least temporarily - use:
git config --global core.autocrlf false
Then run your installation commands involving git clone
again.
To restore Git's behavior later, run git config --global core.autocrlf true
.
/usr/bin/env: ‘bash\r’: No such file or directory
I solved it by finding that autosync.sh somewhere in my projects hidden and changed file format to Unix and boom it worked.
Composer installed, but get /usr/bin/env: php: No such file or directory
As @alexhowansky suggested in a comment, I ran the following command:
sudo ln -s /usr/bin/php71 /usr/bin/php
Now the composer command works.
After installing npm on WSL Ubuntu 20.04 I get the message /usr/bin/env: ‘bash\r’: No such file or directory
This may be a line endings issue, but not from Ubuntu. Make sure you have node
and npm
installed correctly:
- From WSL run
sudo apt install nodejs npm
to install node & npm - From PowerShell/CMD run
wsl --shutdown
to restart the WSL service - Next in WSL run
which npm
to confirm it's installed [output: /usr/bin/npm]
Does the problem persist? Try this next:
Stop Windows path variables being shared with WSL by editing the /etc/wsl.conf
file in WSL. If the file doesn't exist, execute sudo touch /etc/wsl.conf
first. Edit the file with the command sudo nano /etc/wsl.conf
and add the following configuration:
[interop]
appendWindowsPath = false
Then restart WSL2 with command wsl --shutdown
in Windows.
Note 1: This will stop the PATH environment variables from Windows passing through to WSL. Known bug: this stops the VSCode code .
command from working in WSL. If this is a problem, use NVM solution described here or switch to using node in a docker container.
Note 2: this also affects pyenv
command, see /usr/bin/env: ‘bash\r’: No such file or directory: Incompatible line-endings (WSL?)
Tip from @mike: "I did not want to disable the ability to do code .
so I just removed the windows nodejs path by adding this line to my ~/.bashrc PATH=$(echo "$PATH" | sed -e 's%:/mnt/c/Program Files/nodejs%%')"
Laravel sail bash\r in docker
Run the dos2unix command which changed many project files and it worked there.
yiic - can't run - env: php\r: No such file or directory
I just read this blog: could be the very same problem you are experiencing?
The next step is to tell the yiic application, found in the framework folder, to create a new site. The syntax is
yiic webapp path/to/directoryBut before you even begin to use this command, let me explain it a bit, as it’s very important and can be complicated. The yiic file is an executable that runs using the computer’s command-line PHP and that really just invokes the yiic.php script. You may be able to call it using just yiic or using ./yiic (i.e., run the yiic command found in the current directory). Or you can more explicitly call either script using php yiic or php yiic.php. Or you may need to indicate the PHP executable to be used: C:\php\php.exe yiic. You should try the variations on this command, as applicable to your computer, just to make sure you can invoke yiic, prior to trying to create the Web application.
Related Topics
Getting Data from a Textarea into a Database
Session Id Is Changing After Every Request
How to Fetch Data After Selecting from Dropdown List
How to Set the Default Value of an Attribute on a Laravel Model
How to Get Comma Separated Values from a Table in Laravel
Auto Update Cart on Click in Woocommerce
How to Remove Duplicate Rows in Laravel
Character Encoding for French Accents
How to Pass Something With Apostrophe to Json
How to Update Multiple Select Box Values in PHP MySQL
Assign Jquery Value to PHP Variable Inside Ajax Sussess
How to Sends Two Values in Select Dropdown Using PHP
Open Modal from Another Page Laravel
Auto Update Cart on Quantity Change in Woocommerce Cart Page
Send File Via Curl from Form Post in PHP