skip to Main Content

I ran the flutter build web command and got an error. I have tried everything.. I ran flutter clean, and flutter pub get and several other commands but it still gives me the error:

Target dart2js failed: ProcessException: Process exited abnormally with exit code 254:
../../Downloads/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot: Error: Error when reading
'../../Downloads/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot': No such file or directory
  Command: /Users/osuyaalex/Downloads/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
  /Users/osuyaalex/Downloads/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot
  --platform-binaries=/Users/osuyaalex/Downloads/flutter/bin/cache/flutter_web_sdk/kernel --invoker=flutter_tool -Ddart.vm.product=true
  -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/ -DFLUTTER_WEB_AUTO_DETECT=true
  --native-null-assertions --no-source-maps -o /Users/osuyaalex/AndroidStudioProjects/gagna/.dart_tool/flutter_build/5389598c2a36d064db55a8edf57e320f/app.dill
  --packages=.dart_tool/package_config.json --cfe-only
  /Users/osuyaalex/AndroidStudioProjects/gagna/.dart_tool/flutter_build/5389598c2a36d064db55a8edf57e320f/main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:321:19)
<asynchronous suspension>
#2      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:193:5)
<asynchronous suspension>
#3      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:524:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:524:21)
<asynchronous suspension>
#7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:642:16)
<asynchronous suspension>
#9      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:92:34)
<asynchronous suspension>
#10     BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:230:5)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:93:3)
<asynchronous suspension>

Compiling lib/main.dart for the Web...                           1,192ms
Error: Failed to compile application for the Web.

Please I need assistance on how to make this work

2

Answers


  1. Do you already try flutter pub cache clean?

    1. Clear cache
      dart pub cache clean or flutter pub cache clean

    2. Clear project
      flutter clean

    3. Downlooad dependencies
      flutter pub get

    Login or Signup to reply.
  2. Try to delete the folder at Downloads/flutter/bin/cache/.

    Also share your pubspec.yaml, maybe you’re using a package that doesn’t support web.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search