root is unable to find flutter command - flutter

when I run the flutter doctor command or other flutters command on ubuntu it works fine..
but when I switch to root user with
sudo su
then I run
flutter doctor
then it throws an Error
Command 'flutter' not found, but can be installed with:
snap install flutter
I don't know why this happening can some one help me to find actual problem thanks in advance ..

as #Chance helped me to add flutter path in root bashrc file
i have added flutters path in /etc/bash.bashrc file and now its working in root user also.. thx again #Chance

Related

flutter doctor: cannot change profile for the next exec call: No such file or directory

A few hours ago I installed Flutter using SNAP, then I ran the "flutter doctor" and it returned the following error...
[ cannot change profile for next exec call: No such file or directory ]
flutter doctor: cannot change profile for the next exec call: No such file or directory
I believe I have to get to the installation directory, but I don't know how to do it.
I ask for help.
Since now, thank you very much for your attention!
I had the similar issue with other package, re-installing the package worked for me.
sudo apt-get reinstall package_name

When i press run flutter it is show "Error: No pubspec.yaml file found. This command should be run from the root of your Flutter project. :"

When I press run flutter it is show
Error: No pubspec.yaml file found. This command should be run from the root of your Flutter project.
the Error image
flutter doctor
How can I fix it?
The ua is not the correct directory for your project. You need to change your working directory with:
cd ali
Then, you can flutter run.

flutter doctor 'zsh: command not found'

I have installed flutter and set up the path with the zsh file for Catalina version of mac however when I run flutter doctor or flutter precache, I receive zsh: command not found: flutter. NOTE: I managed to get through these steps previously and set up android studio however I had issues when I tried to connect the simulator for Xcode and now I have had to start again.
UPDATE: When running 'flutter' or 'flutter doctor', I receive this error: Error when reading '../../../../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No such file or directory and it says that pub upgrade failed after 10 tries.
How would I solve this?
When I run ls -a in the home directory, I see that there's a .bash_profile, a .zshrc file and a .zprofile (which I created previously) in there. Is this related to the problem?
This looks like you don't have flutter on your PATH in ZSH.
Open your .zshrc file in your terminal with
nano .zshrc
You should see the following at the top of the file
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
Add on the second line the path to the bin directory of your flutter SDK location, like mine:
export PATH=$HOME/bin:/usr/local/bin:$PATH:/Users/joaosoares/Projects/flutter/bin

flutter command is not working in linux 14, it shows command not found, but it is already in path

Flutter command not found
i tried adding flutter path, and it added to my path
/home/shameer/.nvm/versions/node/v10.14.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/shameer/.local/bin/aws:/home/shameer/.local/bin/python:/usr/lib/jvm/java-8-oracle:/home/shameer/Android/Sdk/emulator:/home/shameer/Android/Sdk/tools:/home/shameer/Android/Sdk/tools/bin:/home/shameer/Android/Sdk/platform-tools:/home/shameer/.local/bin/aws:/home/shameer/.composer/vendor/bin:/home/Flutter/flutter/bin
but still command not found
please help me to solve this issue.. thanks

Setting up flutter

I am new to flutter and having problem running flutter doctor. I have extracted the files in another folder and tried setting the path, echo $PATH gives
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
but still on running flutter doctor it says
flutter command is not found
Anybody who can help please ?
Flutter is not yet set in your PATH.
Try:
Step 1:
sudo nano .profile
Step 2:
export PATH="<Path To extracted Flutter directory>/bin:$PATH"
Step 3:
source .profile
Here is official link how to setup flutter environment
Download flutter.zip
Extract the file in the desired location, for example:
cd ~/development
unzip ~/Downloads/flutter_macos_v1.0.0-stable.zip
Add the flutter tool to your path:
export PATH=$PATH:`pwd`/flutter/bin
Try this if you are in ubuntu in terminal
sudo gedit /etc/profile
then add to the end of the file
export PATH=$PATH:`path to your extracted flutter directory`/flutter/bin
Then logout and login or restart
then
if you see flutter/bin in your path it will work. Hop it helps
try this, i hope it can help,
(in terminal)
first,
PATH=$(getconf PATH)
secondly,
export PATH="$PATH:<Flutter directory>/flutter/bin"