How to Solve Command Not Found in Flutter?
Table of Contents
When the user installs and configures Flutter For the First time, when the user runs a command on a terminal, the user gets an error like Command Not Found. So in this article, we will go through How to Solve Command Not Found in Flutter.
How to Solve Command Not Found in Flutter?
You need to correctly set up your flutter path from here https://flutter.dev/docs/get-started/install/macos#update-your-path
- Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
- Open (or create) $HOME/.bash_profile. You can do that by using a terminal text editor by going in the terminal and typing nano ~/.bash_profile
macOS uses the Z shell by default, so edit $HOME/.zshrc.
If you are using a different shell, the file path and filename will be different on your machine.
- Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s git repo:
- Press CTRL X and when it asked you to save the file, choose yes
- Run source $HOME/.bash_profile to refresh the current window or restart the terminal
- Verify that the flutter/bin directory is now in your PATH by running: echo $PATH
Notice that [PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed flutter SDK, not the location of your app
Instead of nano, you can use any text editor to edit ~/.bash_profile
Hence, directly add it to the path file permanently like below.
sudo nano /etc/paths
add this to the file
Users can try the below things
- Download the Flutter SDK from Flutter SDK Archive
- Extract it where do you want (for example/home/development/flutter)
- Set your PATH, edit your file with this command gedit ~/.profile, you need to add this line
So our export will look like this
- Save the file and close it.
- Run source ~/.profile to load the changes
- If you run now flutter doctor should work!
If you are using zsh, you need to follow the below steps in mac.
- Download the latest flutter from the official site.
- Unzip it and move to the $HOME location of your mac.
- Add to the path via .zshrc file
- run nano ~/.zshrc into iTerm2 terminal.
- export PATH=$HOME/flutter/bin:$PATH
- Save and close ~/.zshrc file.
- re-start iTerm2
- Now you will have Flutter available.
Do this to add Flutter permanently to your path in Ubuntu :
- Append the line:
in the text file and save it.
Open a new terminal and run the flutter doctor command
Flutter SDK can run on Windows as well as macOS
- First, download the latest SDK from the flutter download page.
- Now to run flutter in the windows console you need to update your PATH environment variable.
- From the Start search bar, type ‘env’ and select Edit environment variables for your account.
- Under User, variables check if there is an entry called Path.
1. If the entry does exist, append the full path to flutter\bin using as a separator from existing values.
2. If the entry does not exist, create a new user variable named Path with the full path to flutter\bin as its value.
- First, download the latest SDK from the flutter download page
- Extract the file in the desired location using the following commands :
1. cd ~/development
- Add the flutter tool to your path:
Run flutter doctor
For Linux: To remember flutter commands permanently:
- open up terminal and cd to $HOME. for eg: username@linux:~$
- open the hidden file .bashrc with your desired editor. It resides in $HOME.eg. sudo gedit .bashrc
- add the following line export PATH=/home/username/flutter/bin:$PATH somewhere as a newline in .bashrc file preferably as the last line edit & save the file.
- Run source /home/yourname/.bashrc in terminal to process your recent changes.
- Finally, run echo $PATH to see flutter dir is in your system path along with other such paths for eg: /home/username/flutter/bin
So in this article, we have learned about how to Solve Command Not Found in Flutter.
Thanks for Reading!!! Keep Fluttering.
Do let us know if you need any assistance with Flutter Development?
Flutter Agency is one of the most popular online portals dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge of Flutter.
Frequently Asked Questions (FAQs)
1. Which coding is used in Flutter app development?
2. What is the main objective of Flutter?
Flutter is Google’s portable UI toolkit for developing beautiful, native compiled mobile, web, and desktop apps from a single codebase. Flutter will work with free and open-source code being used by Flutter developers and organizations worldwide.
3. How do you fix Flutter if it is not identified as an internal or external command?
Go to my computer programs>advanced system setting>environment variables. In this manner, you can solve Flutter, which is not recognized as an external or internal command issue in the windows operating system