Reputation: 23
I have already added the path to the flutter SDK in the PATH. In the terminal everything works, but in the VSCode terminal it doesn't. An error appears saying that there is no such command. What is wrong with it?
Upvotes: 0
Views: 7839
Reputation: 31
checkout: https://docs.flutter.dev/get-started/install/macos#update-your-path
I believe the flutter documentation on adding it to path should be reviewed to avoid such error with beginners; whether temporary or permanent usage uniformity should be key because not everyone would quickly notice it. Your VS code is not starting from the referenced point hence why it's working normal in bash, zsh or whichever you are using but fails sometimes to see flutter in VS code terminal. Please note that if your VS code is started from your terminal it will work well.
Use a proper starting point, the pwd
means present working directory which might give a different value under certain conditions hence it won't point correctly to your flutter folder in such cases.
This will fix the problem for all cases; just change pwd
to use the absolute path or any other reference point that doesn't change. You can use the ~ reference too; just ensure you can cd
into your flutter folder from any point using your reference choice.
In my own case on macOs: the downloaded flutter package was extracted, folder renamed to flutter then placed in my home directory hence
replaced: export PATH="$PATH:`pwd`/flutter/bin";
with: export PATH="$PATH:/Users/kehindeehinmitan/flutter/bin";
Upvotes: 0
Reputation: 2127
In terminal go to the root of the project where you created you flutter project. Then it will work.
Upvotes: 1