简体   繁体   中英

Weird behavior of flutter and dart commands in PowerShell and CMD

I'm relatively new to Flutter but I already have developed and finished some Apps in Flutter. Recently I noticed a weird behavior of commands with the keywords "dart" or "flutter" in it.

Here is an example: I was trying to migrate an existing project to the new dart null-safety and typed the command dart migrate into my Visual-Studio-Code Terminal. I was expecting an output like Migrating C:\.... as a response but instead got these three lines:

The command "git" is either misspelled or could not be found.
Building flutter tool... 
Running pub upgrade... 

and then the expected output:

Migrating C:\<project path>...

and so on.

So basically the commands work as they would normally do but I get these three lines before the output everytime. And it's not only with this command. Also basic commands like dart help or flutter doctor will get these three lines.

I don't know what I am doing wrong. I uninstalled Flutter and also removed it from the PATH and then reinstalled it freshly but it's still the same. I also searched the web but didn't found anyone who has the same problem.

Any help and explanation would be great. Thank you for your time:)

I think I know where the problem is. I ran the commands directly when I opened PowerShell. But the directory was something like C:\Windows\ and then it won't work. After I did cd C:\Users\User all commands will work as expected.

I was just thinking that it doesn't matter from where I run dart and flutter commands obviously you have to be in your user directory that they will work properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM