1
votes

I have cloned the https://github.com/flutter/flutter_web repository and I'm trying to run the hello_world program in the examples directory.

I have done everything instructed in the GitHub page. Additionally, I installed the dart SDK using apt because i was getting another error, "webdev dart: not found", this was fixed.

Now I'm getting the following error when running "webdev serve", "The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again."

I ran "flutter pub get" and "flutter pub upgrade", this did not fix it.

I expected this to start a web server on port 8080.The output of

flutter pub get -v

is

[  +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.

and the output of

webdev serve -v

is

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.

My Current directory

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
1
how about flutter packages get and what is your flutter version - Blasanka
@Blasanka unfortunately, that did not work either. My flutter version is "Flutter 1.5.4-hotfix.2" - Meth Munindradasa
Set your dart-sdk bin directory path in environment path(windows). In my case I had dart-sdk installed separately. if you dont have that use flutter one. As a example my path is C:\flutter\bin\cache\dart-sdk\bin. Let me know if its work - Blasanka
@Blasanka I added /flutter/bin/cache/dart-sdk/bin to PATH and removed the previously installed dart SDK. This did not work either. I'm still getting the previous error. I'm using Linux by the way. - Meth Munindradasa
run flutter pub get -v and post the complete output of this command - pskink

1 Answers

5
votes

There is a solution to this. Found it here, https://github.com/flutter/flutter/issues/32313

use

flutter packages pub global run webdev build

instead of webdev build

and

flutter packages pub global run webdev serve

instead of webdev serve