今天在mac安装flutter的时候遇到到问题

错误如下

Crash when compiling file://users/macos/development/flutter/packages/flutter_tools/bin/flutter_tools.dart,
at character offset null:
Invalid argument(s): Exception when reading 'file://users/macos/development/flutter/packages/flutter_tools/.dart_tool/package_config.json': Cannot extract a non-Windows file path from a file URI with an authority
#0      ProcessedOptions._readFile (package:front_end/src/base/processed_options.dart:533:7)

#1      ProcessedOptions._createPackagesFromFile (package:front_end/src/base/processed_options.dart:547:32)
#2      ProcessedOptions.createPackagesFromFile (package:front_end/src/base/processed_options.dart:612:17)
#3      ProcessedOptions._getPackages (package:front_end/src/base/processed_options.dart:480:32)
#4      ProcessedOptions.getUriTranslator (package:front_end/src/base/processed_options.dart:434:38)

#5      generateKernelInternal. (package:front_end/src/kernel_generator_impl.dart:74:49)
#6      withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#7      generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:73:10)
#8      generateKernel. (package:front_end/src/kernel_generator_impl.dart:53:18)
#9      CompilerContext.runWithOptions. (package:front_end/src/fasta/compiler_context.dart:135:20)

#10     CompilerContext.runWithOptions. (package:front_end/src/fasta/compiler_context.dart)
#11     CompilerContext.runInContext.. (package:front_end/src/fasta/compiler_context.dart:123:46)
#12     new Future.sync (dart:async/future.dart:223:31)
#13     CompilerContext.runInContext. (package:front_end/src/fasta/compiler_context.dart:123:19)
#14     _rootRun (dart:async/zone.dart:1190:13)
#15     _CustomZone.run (dart:async/zone.dart:1093:19)
#16     _runZoned (dart:async/zone.dart:1630:10)
#17     runZoned (dart:async/zone.dart:1550:10)
#18     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#19     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:133:10)
#20     generateKernel (package:front_end/src/kernel_generator_impl.dart:52:32)
#21     kernelForModule (package:front_end/src/api_prototype/kernel_generator.dart:99:17)
#22     SingleShotCompilerWrapper.compileInternal (file:///opt/s/w/ir/cache/builder/src/third_party/dart/pkg/vm/bin/kernel_service.dart:441:17)
#23     Compiler.compile. (file:///opt/s/w/ir/cache/builder/src/third_party/dart/pkg/vm/bin/kernel_service.dart:208:45)
#24     new Future. (dart:async/future.dart:175:37)
#25     _rootRun (dart:async/zone.dart:1182:47)
#26     _CustomZone.run (dart:async/zone.dart:1093:19)
#27     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#28     _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
#29     _rootRun (dart:async/zone.dart:1190:13)
#30     _CustomZone.run (dart:async/zone.dart:1093:19)
#31     _CustomZone.bindCallback. (dart:async/zone.dart:1021:23)
#32     Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
#33     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#34     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
#35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)


#0      ProcessedOptions._readFile (package:front_end/src/base/processed_options.dart:533:7)

#1      ProcessedOptions._createPackagesFromFile (package:front_end/src/base/processed_options.dart:547:32)
#2      ProcessedOptions.createPackagesFromFile (package:front_end/src/base/processed_options.dart:612:17)
#3      ProcessedOptions._getPackages (package:front_end/src/base/processed_options.dart:480:32)
#4      ProcessedOptions.getUriTranslator (package:front_end/src/base/processed_options.dart:434:38)

#5      generateKernelInternal. (package:front_end/src/kernel_generator_impl.dart:74:49)
#6      withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#7      generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:73:10)
#8      generateKernel. (package:front_end/src/kernel_generator_impl.dart:53:18)
#9      CompilerContext.runWithOptions. (package:front_end/src/fasta/compiler_context.dart:135:20)

#10     CompilerContext.runWithOptions. (package:front_end/src/fasta/compiler_context.dart)
#11     CompilerContext.runInContext.. (package:front_end/src/fasta/compiler_context.dart:123:46)
#12     new Future.sync (dart:async/future.dart:223:31)
#13     CompilerContext.runInContext. (package:front_end/src/fasta/compiler_context.dart:123:19)
#14     _rootRun (dart:async/zone.dart:1190:13)
#15     _CustomZone.run (dart:async/zone.dart:1093:19)
#16     _runZoned (dart:async/zone.dart:1630:10)
#17     runZoned (dart:async/zone.dart:1550:10)
#18     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#19     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:133:10)
#20     generateKernel (package:front_end/src/kernel_generator_impl.dart:52:32)
#21     kernelForModule (package:front_end/src/api_prototype/kernel_generator.dart:99:17)
#22     SingleShotCompilerWrapper.compileInternal (file:///opt/s/w/ir/cache/builder/src/third_party/dart/pkg/vm/bin/kernel_service.dart:441:17)
#23     Compiler.compile. (file:///opt/s/w/ir/cache/builder/src/third_party/dart/pkg/vm/bin/kernel_service.dart:208:45)
#24     new Future. (dart:async/future.dart:175:37)
#25     _rootRun (dart:async/zone.dart:1182:47)
#26     _CustomZone.run (dart:async/zone.dart:1093:19)
#27     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#28     _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
#29     _rootRun (dart:async/zone.dart:1190:13)
#30     _CustomZone.run (dart:async/zone.dart:1093:19)
#31     _CustomZone.bindCallback. (dart:async/zone.dart:1021:23)
#32     Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
#33     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#34     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
#35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

macosdeiMac:~ macos$ 

注意看错误 很明显是路径哪里出了问题

Crash when compiling file://users/macos/development/flutter/packages/flutter_tools/bin/flutter_tools.dart

仔细检查了一下发现环境变量多了一个斜杠,在大家配置环境变量的时候一定要仔细检查

避免出现这样低级的错误 :jingku:

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注