I am unable to build my flutter web project
Asked Answered
H

6

19

When trying to run flutter build web i get "build web" is not currently supported. I had previous errors where i was stuck with Dart 2.5.0-dev.4.0.flutter-be66176534 and required 2.5.0 or higher, this has now been solved but i am unable to build my project.

flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [Version 10.0.18932.1000], locale en-GB)
    • Flutter version 1.9.1+hotfix.2 at C:\src\flutter
    • Framework revision 2d2a1ffec9 (8 days ago), 2019-09-06 18:39:49 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\germa\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[!] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] VS Code (version 1.38.1)
    • VS Code at C:\Users\germa\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.4.1

I have tried

  • re-installing dart
  • re-installing flutter
  • re-installing Visual Studio code
  • copy file contents to a new web project (same error)

I couldn't find any information on what this is caused by and how to resolve it online

What can i do to resolve this error?

Heterotaxis answered 15/9, 2019 at 10:27 Comment(1)
Create a new project for this problem. Maybe you try to run an old project.Swarthy
R
30

Please once do configure like below

  1. flutter channel stable
  2. flutter upgrade
  3. flutter config --enable-web
  4. cd into project directory
  5. flutter create .
  6. flutter run -d chrome
Redford answered 15/9, 2019 at 10:27 Comment(2)
Hi, i have done this, however now i get Unable to find modules for some sources, this is usually the result of either a bad import, a missing dependency in a package (or possibly a dev_dependency needs to move to a real dependency), or a build failure (if importing a generated file). Do you know how to fix this ?Heterotaxis
It work for me but at last face character issue, so install "characters 1.0.0" dependency. pub.dev/packages/characters#-installing-tab- Github issue: github.com/flutter/flutter/issues/59645Autotoxin
R
8

So currently you are at stable channel . You have to switch to the beta channel as flutter web is not at a stable channel right now. In order to make it working run the following commands in the terminal.

  1. flutter channel beta
  2. flutter upgrade
  3. flutter config --enable-web.

    After that restart your IDE and build the web app.

Rozella answered 19/2, 2020 at 7:10 Comment(1)
This works for me - the official docs are hereOrthostichy
G
2

I was facing problem in flutter stable 2.0.2, by running

flutter create .

it was not creating web module, after upgrading it has started working. I guess my flutter web sdk had some issue so by fresh upgrade it got fixed.

Grummet answered 31/3, 2021 at 21:26 Comment(0)
M
0

if your are facing the problem

Ambiguous organization in existing files: {package_name1, package_name2}. The --org command line argument must be specified to recreate project.

you can use this command

flutter create --org package_name1 .

And

flutter run -d chrome
Mousetrap answered 18/9, 2021 at 13:10 Comment(0)
E
0

Just check whether you have used any plugins in pubspecs.yaml that is nonweb supportive.

Envision answered 13/1, 2022 at 5:52 Comment(0)
N
0

you have to add web support to an existing app:

flutter create .

then try to

flutter build web
Neoclassic answered 9/1, 2023 at 5:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.