0

dartdoc为我的飞镖包运行时出现此错误:

Documenting my_library...
Initialized dartdoc with 42 libraries in 12.1 seconds
Generating docs for library my_library from package:my_library/my_library.dart...

dartdoc 4.1.0 (/D:/Development/Flutter/Flutter%20SDK/bin/cache/dart-sdk/bin/snapshots/dartdoc.dart.snapshot) failed: Invalid argument (uri): Unknown package: Instance of '_SimpleUri'
#0      ResourceLoader.resolveResourceUri.<anonymous closure> (package:dartdoc/src/generator/resource_loader.dart:46:11)
#1      _rootRunUnary (dart:async/zone.dart:1436:47)
#2      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
<asynchronous suspension>
#3      ResourceLoader.getResourceFile (package:dartdoc/src/generator/resource_loader.dart:31:15)
<asynchronous suspension>
#4      ResourceLoader.loadResourceAsBytes (package:dartdoc/src/generator/resource_loader.dart:27:13)
<asynchronous suspension>
#5      HtmlGeneratorBackend._copyResources (package:dartdoc/src/generator/html_generator.dart:71:11)
<asynchronous suspension>
#6      HtmlGeneratorBackend.generateAdditionalFiles (package:dartdoc/src/generator/html_generator.dart:49:5)
<asynchronous suspension>
#7      GeneratorFrontEnd.generate (package:dartdoc/src/generator/generator_frontend.dart:22:5)
<asynchronous suspension>
#8      Dartdoc.generateDocsBase (package:dartdoc/dartdoc.dart:196:5)
<asynchronous suspension>
#9      Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:233:24)
<asynchronous suspension>
#10     Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/dartdoc.dart:493:9)
<asynchronous suspension>

dart pub global activate dartdoc返回:

Resolving dependencies...
+ _fe_analyzer_shared 31.0.0 (32.0.0 available)
+ analyzer 2.8.0 (3.0.0 available)
+ args 2.3.0
+ async 2.8.2
+ charcode 1.3.1
+ cli_util 0.3.5
+ collection 1.15.0
+ convert 3.0.1
+ crypto 3.0.1
+ csslib 0.17.1
+ dartdoc 4.1.0
+ file 6.1.2
+ glob 2.0.2
+ html 0.15.0
+ logging 1.0.2
+ markdown 4.0.1
+ meta 1.7.0
+ package_config 2.0.2
+ path 1.8.1
+ pub_semver 2.1.0
+ source_span 1.8.1
+ string_scanner 1.1.0
+ term_glyph 1.2.0
+ typed_data 1.3.0
+ watcher 1.0.1
+ yaml 3.1.0
Building package executables...
Built dartdoc:dartdoc.
Installed executable dartdoc.
Activated dartdoc 4.1.0.

dart analyze并且flutter analyze都返回:

Analyzing my_library...
No issues found!
4

1 回答 1

0

I had an environment variable in path that led to Flutter SDK\bin\cache\dart-sdk\bin. Removing this variable solved the issue.

于 2021-12-30T13:32:37.010 回答