Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter for Web: webdev serve throws error: webdev could not find pubspec.yaml in "C:\...."

Tags:

flutter

dart

I am trying to run a Flutter for web project, which was working just fine, until I ran flutter packages run, after which webdev serve gives the error above. My project is located in a different directory, E:\Flutter_web_try to be specific, which has a pubspec.yaml file.

I have already tried flutter pub pub packages get, reinstalling flutter, deactivating and reactivating webdev but none of those have worked. No new flutter_web project I create is running either, and throws the same error. I have also tried installing a fresh version of Flutter, with the env variables changed, but still the error remained the same.

webdev could not run for this project.
Could not find a file named "pubspec.yaml" in "C:\Users\Sanchit\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\protobuf-0.13.12".```

It should run properly, and tell me the default port at which the project is being served on, which it did before the flutter packages get command.
like image 301
Imperpetual Machine Avatar asked Sep 02 '25 06:09

Imperpetual Machine


1 Answers

You're having that issue because your webdev path is not setup correctly. If you still want to run your web app, go to that path and execute:

flutter packages pub global run webdev serve

Same thing if you want to build your web app to release:

flutter packages pub global run webdev build

be sure to finish your webdev serve (control + c) before building or is not going to work.

like image 83
Mariano Zorrilla Avatar answered Sep 04 '25 19:09

Mariano Zorrilla