flutter_web helloworld 示例的 webdev 服务命令错误

webdev serve command errors out for flutter_web helloworld example

我已经克隆了 https://github.com/flutter/flutter_web 存储库,我正在尝试 运行 示例目录中的 hello_world 程序。

我已完成 GitHub 页面中指示的所有操作。 此外,我使用 apt 安装了 dart SDK,因为我遇到了另一个错误,"webdev dart: not found",已修复。

现在 运行ning "webdev serve" 时出现以下错误, "The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "酒吧再次获得“。”

我运行"flutter pub get"和"flutter pub upgrade",这并没有解决它。

我预计这会在端口 8080.The 输出

上启动 Web 服务器
flutter pub get -v

[  +18 ms] executing: [/home/meth/Documents/development/flutter/] git log -n 1 --pretty=format:%H
[  +21 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[        ] 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
[        ] executing: [/home/meth/Documents/development/flutter/] git describe --match v*.*.* --first-parent --long --tags
[   +7 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.5.4-hotfix.2-0-g7a4c33425
[   +8 ms] executing: [/home/meth/Documents/development/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +5 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/meth/Documents/development/flutter/] git ls-remote --get-url origin
[   +7 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +36 ms] executing: [/home/meth/Documents/development/flutter/] git rev-parse --abbrev-ref HEAD
[   +8 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +21 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FuchsiaCacheArtifacts' is not required, skipping update.
[  +16 ms] Running "flutter packages get" in hello_world...
[   +3 ms] Using /home/meth/Documents/development/flutter/.pub-cache for the pub cache.
[   +1 ms] executing: [/home/meth/Documents/work/flutter_web/examples/hello_world/] /home/meth/Documents/development/flutter/bin/cache/dart-sdk/bin/pub --verbosity=warning --verbose get
--no-precompile
[ +440 ms] ! flutter_web 0.0.0 from path ../../packages/flutter_web
[   +1 ms] ! flutter_web_ui 0.0.0 from path ../../packages/flutter_web_ui
[  +49 ms] Running "flutter packages get" in hello_world... (completed in 0.5s)
[ +166 ms] "flutter get" took 717ms.
[        ] "flutter get" took 717ms.

的输出
webdev serve -v

webdev could not run for this project.
The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.

我的当前目录

drwxrwxr-x 3 meth meth  4096 Jun  9 07:38 android
drwxrwxr-x 4 meth meth  4096 Jun  9 07:38 ios
drwxrwxr-x 2 meth meth  4096 Jun  9 07:41 lib
-rw-rw-r-- 1 meth meth 10592 Jun  9 12:00 pubspec.lock
-rw-rw-r-- 1 meth meth   400 Jun  9 07:55 pubspec.yaml
drwxrwxr-x 2 meth meth  4096 Jun  9 07:40 web

有解决办法。在这里找到了, https://github.com/flutter/flutter/issues/32313

使用

flutter packages pub global run webdev build

而不是webdev build

flutter packages pub global run webdev serve

而不是webdev serve