Francesco Iapicca
Francesco Iapicca

Reputation: 2667

How to update pub package webdev for flutter web

when I try to "serve" my flutter web app I'm getting this error:

This version of webdev does not support the build_daemon protocol used by your version of build_runner. A newer version of webdev is available which supports your version of the build_daemon. Please update.

how do I update webdev ? "pub global" seems to offer only "activate"/ "deactivate" and "pub upgrade" is only looking into the pubspec.yaml file

any idea?

Upvotes: 2

Views: 1657

Answers (6)

I had to use the following command to update webdev

flutter pub global run webdev deactivate 

and then

flutter pub global run webdev activate

Upvotes: 0

Hoylen
Hoylen

Reputation: 17125

Do not use a global version, but use a per-project version.

To ensure running webdev on your project always works, include the version of webdev it requires in the pubspec.yaml file:

dev_dependencies:
  webdev: ^2.7.9
  ...

And run it using:

$ dart run webdev ...

This ensures the correct version of webdev is installed when dart pub get is run, and that particular version is used for the project.

This avoids having to update the global version when things change. Running dart pub global deactivate webdev and dart pub global activate webdev is unnecessary work.

Globals are bad. Using "dart pub global activate ..." installs only one version of webdev, which may become out-of-date with your project (as you've discovered). Or you might have multiple Dart projects, and they require different versions of webdev. The above approach uses a per-project version of webdev, ensuring it is always the correct version for the project.

Upvotes: 1

ke Chankrisna
ke Chankrisna

Reputation: 301

Here is what i configured in my computer

  • run: pub get
  • run: webdev serve
dev_dependencies:
  build_daemon: ^1.0.0
  build_runner: ^1.4.0
  build_web_compilers: ^2.0.0

Wish this will fix your issues.

Upvotes: 0

Zoul Barizi
Zoul Barizi

Reputation: 530

Adding build_daemon: ^1.0.0 in dev_dependencies: of .yaml file fix my error

Upvotes: 1

viggis75
viggis75

Reputation: 1

I got the same problem now when I followed this tutorial https://medium.com/flutter-community/flutter-create-and-deploy-a-website-from-scratch-4a026ebd6c, but I didn't get pass the error by running flutter pub global activate.

Upvotes: 0

Francesco Iapicca
Francesco Iapicca

Reputation: 2667

Oh... I just run "pub global deactivate " and then "pub global activate ". Anyway I opened an issue on github suggesting to add the feature "update". I hope this easy solution might help you, feel free to follow up the issue.

Upvotes: 4

Related Questions