Flutter commands not found using Bash or ZSH on Windows
The error message $'\r': command not found
means that your script has Windows-style newline endings. I've encountered it often enough I now recognize on sight!
Convert /mnt/c/flutter/bin/flutter
and any other bash scripts to Unix-style newlines and the problem should go away.
MaylorTaylor
Updated on December 13, 2022Comments
-
MaylorTaylor over 1 year
I recently downloaded and setup the new Windows Terminal on Windows 10. It requires you to download Ubuntu and then install Windows Terminal (UWP); but once you do that, you have access to Bash in Windows.
All of that is working correctly. I then setup ZSH (Oh-My-ZSH) and got that working fine. I can use ZSH to do
git
andnpm
commands but when I try and run anyflutter
commands I get errors. I also get the same errors when i switch my terminal over tobash
.My
.bash_profile
has only 1 line in it:export PATH=$PATH:/flutter/bin
I would love to get my
flutter commands
working inbash
andzsh
. But it currently only works incmd
.My bash files are located at
C:\home\<username>
and flutter is installed atC:\flutter
I have also added
export PATH=$PATH:/flutter/bin
to my.zshrc
file. (open ZSH, runnano ~/.zshrc
)-
Ryosuke over 4 yearsadd
export PATH=$PATH:/flutter/bin
in your .zshrc file also. -
MaylorTaylor over 4 yearsI updated the OP to show that I have in fact added the export path to my .zshrc file -- however, i get the exact same error
-
-
MaylorTaylor over 4 yearsThis was the issue! Found an easy guide here