gpt4 book ai didi

dart - 在 Windows 上没有 pub 的情况下运行 webdev 错误

转载 作者:行者123 更新时间:2023-12-01 19:02:30 26 4
gpt4 key购买 nike

我在 Windows 10 上进行 AngularDart 开发。最近我在 webdev 上遇到了奇怪的行为。我必须像这样运行 webdev:

C:\Users\galankus>C:\tools\dart-sdk\bin\pub.bat global run webdev
A tool to develop Dart web projects.

Usage: webdev <command> [arguments]

Global options:
-h, --help Print this usage information.

Available commands:
build Run builders to build a package.
help Display help information for webdev.
serve Run a local web development server and a file system watcher that re-builds on changes.

Run "webdev help <command>" for more information about a command.

如果我尝试直接运行它,则会得到以下结果。关于如何调试/修复这个问题有什么想法吗?

C:\Users\galankus>webdev
Crash when formatting: [Encoding] Unable to decode bytes as UTF-8.
RangeError (index): Invalid value: Not in range 0..271500, inclusive: 271792
#0 _StringBase.[] (dart:core/runtime/libstring_patch.dart:233:55)
#1 Source.getTextLine (package:kernel/ast.dart:5772:42)
#2 getSourceLine (package:front_end/src/fasta/messages.dart:27:9)
#3 format (package:front_end/src/fasta/command_line_reporting.dart:80:27)
#4 ProcessedOptions.format (package:front_end/src/base/processed_options.dart:206:32)
#5 ProcessedOptions.report (package:front_end/src/base/processed_options.dart:215:22)
#6 CompilerContext.report (package:front_end/src/fasta/compiler_context.dart:67:13)
#7 Loader.addMessage (package:front_end/src/fasta/loader.dart:258:20)
#8 Loader.addCompileTimeError (package:front_end/src/fasta/loader.dart:207:5)
#9 LibraryBuilder.addCompileTimeError (package:front_end/src/fasta/builder/library_builder.dart:89:12)
#10 SourceLoader.tokenize (package:front_end/src/fasta/source/source_loader.dart:174:17)
<asynchronous suspension>
#11 SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:192:26)
<asynchronous suspension>
#12 Loader.buildOutlines (package:front_end/src/fasta/loader.dart:176:13)
<asynchronous suspension>
#13 KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:237:20)
<asynchronous suspension>
#14 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:232:24)
<asynchronous suspension>
#15 CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:46)
#16 new Future.sync (dart:async/future.dart:222:31)
#17 CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:19)
#18 _rootRun (dart:async/zone.dart:1126:13)
#19 _CustomZone.run (dart:async/zone.dart:1023:19)
#20 _runZoned (dart:async/zone.dart:1518:10)
#21 runZoned (dart:async/zone.dart:1465:12)
#22 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:117:12)
#23 IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:102:20)
<asynchronous suspension>
#24 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:38:44)
<asynchronous suspension>
#25 IncrementalCompilerWrapper.compileInternal (file:///E:/b/build/slave/dart-sdk-windows-dev/build/sdk/pkg/vm/bin/kernel_service.dart:158:28)
<asynchronous suspension>
#26 Compiler.compile.<anonymous closure> (file:///E:/b/build/slave/dart-sdk-windows-dev/build/sdk/pkg/vm/bin/kernel_service.dart:132:39)
#27 new Future.<anonymous closure> (dart:async/future.dart:174:37)
#28 _rootRun (dart:async/zone.dart:1122:38)
#29 _CustomZone.run (dart:async/zone.dart:1023:19)
#30 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#31 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#32 _rootRun (dart:async/zone.dart:1126:13)
#33 _CustomZone.run (dart:async/zone.dart:1023:19)
#34 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
#35 Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#36 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#37 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#38 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

Crash when compiling file:///C:/Users/galankus/AppData/Roaming/Pub/Cache/global_packages/webdev/bin/webdev.dart.snapshot,
at character offset 264110:
RangeError (index): Invalid value: Not in range 0..271500, inclusive: 271792
#0 _StringBase.[] (dart:core/runtime/libstring_patch.dart:233:55)
#1 Source.getTextLine (package:kernel/ast.dart:5772:42)
#2 getSourceLine (package:front_end/src/fasta/messages.dart:27:9)
#3 format (package:front_end/src/fasta/command_line_reporting.dart:80:27)
#4 ProcessedOptions.format (package:front_end/src/base/processed_options.dart:206:32)
#5 ProcessedOptions.report (package:front_end/src/base/processed_options.dart:215:22)
#6 CompilerContext.report (package:front_end/src/fasta/compiler_context.dart:67:13)
#7 Loader.addMessage (package:front_end/src/fasta/loader.dart:258:20)
#8 Loader.addCompileTimeError (package:front_end/src/fasta/loader.dart:207:5)
#9 LibraryBuilder.addCompileTimeError (package:front_end/src/fasta/builder/library_builder.dart:89:12)
#10 SourceLoader.tokenize (package:front_end/src/fasta/source/source_loader.dart:174:17)
<asynchronous suspension>
#11 SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:192:26)
<asynchronous suspension>
#12 Loader.buildOutlines (package:front_end/src/fasta/loader.dart:176:13)
<asynchronous suspension>
#13 KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:237:20)
<asynchronous suspension>
#14 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:232:24)
<asynchronous suspension>
#15 CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:46)
#16 new Future.sync (dart:async/future.dart:222:31)
#17 CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:19)
#18 _rootRun (dart:async/zone.dart:1126:13)
#19 _CustomZone.run (dart:async/zone.dart:1023:19)
#20 _runZoned (dart:async/zone.dart:1518:10)
#21 runZoned (dart:async/zone.dart:1465:12)
#22 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:117:12)
#23 IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:102:20)
<asynchronous suspension>
#24 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:38:44)
<asynchronous suspension>
#25 IncrementalCompilerWrapper.compileInternal (file:///E:/b/build/slave/dart-sdk-windows-dev/build/sdk/pkg/vm/bin/kernel_service.dart:158:28)
<asynchronous suspension>
#26 Compiler.compile.<anonymous closure> (file:///E:/b/build/slave/dart-sdk-windows-dev/build/sdk/pkg/vm/bin/kernel_service.dart:132:39)
#27 new Future.<anonymous closure> (dart:async/future.dart:174:37)
#28 _rootRun (dart:async/zone.dart:1122:38)
#29 _CustomZone.run (dart:async/zone.dart:1023:19)
#30 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#31 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#32 _rootRun (dart:async/zone.dart:1126:13)
#33 _CustomZone.run (dart:async/zone.dart:1023:19)
#34 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
#35 Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#36 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#37 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#38 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)


#0 _StringBase.[] (dart:core/runtime/libstring_patch.dart:233:55)
#1 Source.getTextLine (package:kernel/ast.dart:5772:42)
#2 getSourceLine (package:front_end/src/fasta/messages.dart:27:9)
#3 format (package:front_end/src/fasta/command_line_reporting.dart:80:27)
#4 ProcessedOptions.format (package:front_end/src/base/processed_options.dart:206:32)
#5 ProcessedOptions.report (package:front_end/src/base/processed_options.dart:215:22)
#6 CompilerContext.report (package:front_end/src/fasta/compiler_context.dart:67:13)
#7 Loader.addMessage (package:front_end/src/fasta/loader.dart:258:20)
#8 Loader.addCompileTimeError (package:front_end/src/fasta/loader.dart:207:5)
#9 LibraryBuilder.addCompileTimeError (package:front_end/src/fasta/builder/library_builder.dart:89:12)
#10 SourceLoader.tokenize (package:front_end/src/fasta/source/source_loader.dart:174:17)
<asynchronous suspension>
#11 SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:192:26)
<asynchronous suspension>
#12 Loader.buildOutlines (package:front_end/src/fasta/loader.dart:176:13)
<asynchronous suspension>
#13 KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:237:20)
<asynchronous suspension>
#14 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:232:24)
<asynchronous suspension>
#15 CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:46)
#16 new Future.sync (dart:async/future.dart:222:31)
#17 CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:19)
#18 _rootRun (dart:async/zone.dart:1126:13)
#19 _CustomZone.run (dart:async/zone.dart:1023:19)
#20 _runZoned (dart:async/zone.dart:1518:10)
#21 runZoned (dart:async/zone.dart:1465:12)
#22 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:117:12)
#23 IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:102:20)
<asynchronous suspension>
#24 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:38:44)
<asynchronous suspension>
#25 IncrementalCompilerWrapper.compileInternal (file:///E:/b/build/slave/dart-sdk-windows-dev/build/sdk/pkg/vm/bin/kernel_service.dart:158:28)
<asynchronous suspension>
#26 Compiler.compile.<anonymous closure> (file:///E:/b/build/slave/dart-sdk-windows-dev/build/sdk/pkg/vm/bin/kernel_service.dart:132:39)
#27 new Future.<anonymous closure> (dart:async/future.dart:174:37)
#28 _rootRun (dart:async/zone.dart:1122:38)
#29 _CustomZone.run (dart:async/zone.dart:1023:19)
#30 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#31 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#32 _rootRun (dart:async/zone.dart:1126:13)
#33 _CustomZone.run (dart:async/zone.dart:1023:19)
#34 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
#35 Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#36 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#37 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#38 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

编辑:下面的内容没有改变任何内容,我仍然收到上面的错误。

C:\Users\galankus>pub global activate webdev
Package webdev is currently active at version 0.2.3.
Resolving dependencies...
+ args 1.4.3
+ charcode 1.1.1
+ collection 1.14.10
+ io 0.3.2+1
+ meta 1.1.5
+ path 1.6.1
+ pub_semver 1.4.1
+ source_span 1.4.0
+ stack_trace 1.9.2
+ string_scanner 1.0.2
+ webdev 0.2.3
+ yaml 2.1.14
Precompiling executables...
Precompiled webdev:bin\webdev.
Installed executable webdev.
Activated webdev 0.2.3.

最佳答案

这是最近 Dart 版本中的一个错误,已修复。

更新 Dart 和全局激活的 webdev 包应该可以解决这个问题

要更新全局激活的软件包,只需再次激活它即可:

pub global activate webdev

关于dart - 在 Windows 上没有 pub 的情况下运行 webdev 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51279540/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com