You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dart run <package>@ does not provide a package config URI #63186
I was trying the latest <package>@ support and noticed that pubviz does not work with it due to requiring a package config to look up its own assets, using the Isolate.resolvePackageUri API.
I don't know if this is running AOT compiled or not, but either way we should be able to provide a package config, as one definitely is present.
Reproduction steps
dart run pubviz@
Results in:
Bad state: Could not resolve package:pubviz/assets/
package:pubviz/src/executable.dart 64 _createOrOpen
===== asynchronous gap ===========================
dart:async _CustomZone.registerBinaryCallback
../../.pub-cache/hosted/pub.dev/pubviz-6.0.0/bin/pubviz.dart 55 _main.<fn>
package:stack_trace Chain.capture
../../.pub-cache/hosted/pub.dev/pubviz-6.0.0/bin/pubviz.dart 53 _main
../../.pub-cache/hosted/pub.dev/pubviz-6.0.0/bin/pubviz.dart 17 main.<fn>
dart:async runZoned
package:io/src/ansi_code.dart 34 overrideAnsiOutput
../../.pub-cache/hosted/pub.dev/pubviz-6.0.0/bin/pubviz.dart
Alternatively packages should be able to configure in what mode they will run - for instance if they are not AOT compatible they should be able to opt out of that mode and run via precompiled kernel instead (or some other mode). This would also enable dart install to be more broadly applicable.
Alternatively packages should be able to configure in what mode they will run - for instance if they are not AOT compatible they should be able to opt out of that mode and run via precompiled kernel instead (or some other mode). This would also enable dart install to be more broadly applicable.
The goal of dart install is to use self-contained bundles. If you want to run from a kernel snapshot, it would require copying dart.exe and all the snapshots it need into the app bundle to make it self-contained.
to look up its own assets
Since Dart does not have a concept of data assets (unlike Flutter), there is no way to make assets available in a self-contained bundle. If we start supporting data assets to be reported from hook/build.dart and introduce a Dart API (analogous to the Flutter asset bundles), we can support this. The work is tracked in:
The workaround is: Base64 encode your asset as a Dart String.
An alternative is to add pubviz to the dev dependency of projects and run it with dart run pubviz instead. @sigurdm has been advocating to use this more often as it will ensure versioning your dev utilities.
At the risk of... *gestures vaguely*
Could we let a package advertise that "hey, I won't work w/ dart run"?
Do we need guidance to tell folks how to check?
On Thu, Apr 16, 2026 at 2:53 PM Daco Harkes ***@***.***> wrote:
*dcharkes* left a comment (dart-lang/sdk#63186)
<#63186 (comment)>
Alternatively packages should be able to configure in what mode they will
run - for instance if they are not AOT compatible they should be able to
opt out of that mode and run via precompiled kernel instead (or some other
mode). This would also enable dart install to be more broadly applicable.
The goal of dart install is to use self-contained bundles. If you want to
run from a kernel snapshot, it would require copying dart.exe and all the
snapshots it need into the app bundle to make it self-contained.
to look up its own assets
Since Dart does *not* have a concept of data assets (unlike Flutter),
there is no way to make assets available in a self-contained bundle. If we
start supporting data assets to be reported from hook/build.dart and
introduce a Dart API (analogous to the Flutter asset bundles), we can
support this. The work is tracked in:
- #54003 <#54003>
The workaround is: Base64 encode your asset as a Dart String.
An alternative is to add pubviz to the dev dependency of projects and run
it with dart run pubviz instead. @sigurdm <https://github.com/sigurdm>
has been advocating to use this more often as it will ensure versioning
your dev utilities.
—
Reply to this email directly, view it on GitHub
<#63186 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEFCWMITXYXZ6HRPYRNRT4WFI6FAVCNFSM6AAAAACX4DC3OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENRTGY2TONZQGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
The goal of dart install is to use self-contained bundles. If you want to run from a kernel snapshot, it would require copying dart.exe and all the snapshots it need into the app bundle to make it self-contained.
Why is this the goal? What user journey is this solving for?
Without some sort of asset bundling solution in place this ignores many of the use cases that currently work, and just leads to confusion. We cannot deprecate dart pub global activate, as some tools only work that way, and we now have APIs which will throw runtime errors only when installed via dart install or ran via dart run <package>@.
This is bad for users because it is extremely confusing, it just adds more options instead of unifying things, etc.
Setting aside dart install, I would argue that AOT is not at all the correct compiler to use for dart run <package>@, for the following reasons:
These should be considered more of an "ephemeral" execution, and should prioritize time to start executing main over runtime performance. For a large number of these tools the compilation will take longer than the tool execution.
No incremental compilation when packages update.
Causes runtime errors for core APIs with no static warnings of any type.
The best compilation mode for this use case is the incremental kernel compiler, because:
It is the fastest path to executing main for the first run or recompiles, and is fast enough for cached runs that nobody will notice it is slower than AOT.
Supports incremental compilation when packages update
All core APIs work without unexpected runtime errors
Ideally, package authors would be able to choose the default compilation strategy though, since there are trade-offs and no approach will be best for all packages.
I'd argue there are two types of command-line tools that you can use. (1) The package version matters, (2) the package version doesn't matter.
For (1), it's tightly connected to your project. I'd say these should be dev_dependencies and be dart run without @. You'd control the version tightly with non-caret pubspec.yaml or by checking in the pubspec lock.
For (2), these tools should not matter what version they are. E.g. clang, git, .. They are standalone executables. You don't care about what internal versions of the dependencies are used. They have a stable public CLI. These are the ones that are dart installed.
Ideally, package authors would be able to choose the default compilation strategy though, since there are trade-offs and no approach will be best for all packages.
What you're saying is you want the package author to be able to say which of these two types a package is so that dart run @ would automatically pick the right of these two modes?
All core APIs work without unexpected runtime errors
Can you elaborate on this? Which core APIs are you referring to? Where are these APIs defined? CLIs? json formats? Are these APIs stable?
What you're saying is you want the package author to be able to say which of these two types a package is so that dart run @ would automatically pick the right of these two modes?
Correct, I think the package author should be able to determine how their package is compiled and installed. They are ultimately in the best position to make that decision.
This could also be handled by just specifying a set of requirements (dart:mirrors, dart:isolate). But this gets tricky when its actually individual APIs within those libraries which are required.
All core APIs work without unexpected runtime errors
Can you elaborate on this? Which core APIs are you referring to? Where are these APIs defined? CLIs? json formats? Are these APIs stable?
Specifically in this case it's Isolate.resolvePackageUri, but also things like dart:mirrors work. There might also be others although I am not sure. Mirrors is of course experimental still, but Isolate.resolvePackageUri is stable. But afaik the VM is the only environment that supports every API (except the web ones).
Activity
jakemac53 commentedon Apr 16, 2026
cc @sigurdm @jonasfj @bkonyi I am not sure who is actually driving this work
cc @kevmoo as the pubviz owner
bkonyi commentedon Apr 16, 2026
I'm fairly certain this is running in an executable, so it doesn't have access to its own
package_config.json.jakemac53 commentedon Apr 16, 2026
I believe though that you can pass in a
--packages <path>when launching it? If not we should see if we can support that so that these APIs can work.jakemac53 commentedon Apr 16, 2026
Alternatively packages should be able to configure in what mode they will run - for instance if they are not AOT compatible they should be able to opt out of that mode and run via precompiled kernel instead (or some other mode). This would also enable
dart installto be more broadly applicable.jakemac53 commentedon Apr 16, 2026
cc @dcharkes as well
dcharkes commentedon Apr 16, 2026
The goal of
dart installis to use self-contained bundles. If you want to run from a kernel snapshot, it would require copyingdart.exeand all the snapshots it need into the app bundle to make it self-contained.Since Dart does not have a concept of data assets (unlike Flutter), there is no way to make assets available in a self-contained bundle. If we start supporting data assets to be reported from
hook/build.dartand introduce a Dart API (analogous to the Flutter asset bundles), we can support this. The work is tracked in:The workaround is: Base64 encode your asset as a Dart String.
An alternative is to add
pubvizto the dev dependency of projects and run it withdart run pubvizinstead. @sigurdm has been advocating to use this more often as it will ensure versioning your dev utilities.kevmoo commentedon Apr 16, 2026
jakemac53 commentedon Apr 17, 2026
Why is this the goal? What user journey is this solving for?
Without some sort of asset bundling solution in place this ignores many of the use cases that currently work, and just leads to confusion. We cannot deprecate
dart pub global activate, as some tools only work that way, and we now have APIs which will throw runtime errors only when installed viadart installor ran viadart run <package>@.This is bad for users because it is extremely confusing, it just adds more options instead of unifying things, etc.
jakemac53 commentedon Apr 17, 2026
Setting aside
dart install, I would argue that AOT is not at all the correct compiler to use fordart run <package>@, for the following reasons:The best compilation mode for this use case is the incremental kernel compiler, because:
mainfor the first run or recompiles, and is fast enough for cached runs that nobody will notice it is slower than AOT.Ideally, package authors would be able to choose the default compilation strategy though, since there are trade-offs and no approach will be best for all packages.
dcharkes commentedon Apr 20, 2026
I'd argue there are two types of command-line tools that you can use. (1) The package version matters, (2) the package version doesn't matter.
For (1), it's tightly connected to your project. I'd say these should be dev_dependencies and be
dart runwithout@. You'd control the version tightly with non-caret pubspec.yaml or by checking in the pubspec lock.For (2), these tools should not matter what version they are. E.g.
clang,git, .. They are standalone executables. You don't care about what internal versions of the dependencies are used. They have a stable public CLI. These are the ones that aredart installed.What you're saying is you want the package author to be able to say which of these two types a package is so that
dart run @would automatically pick the right of these two modes?Can you elaborate on this? Which core APIs are you referring to? Where are these APIs defined? CLIs? json formats? Are these APIs stable?
jakemac53 commentedon Apr 29, 2026
Correct, I think the package author should be able to determine how their package is compiled and installed. They are ultimately in the best position to make that decision.
This could also be handled by just specifying a set of requirements (dart:mirrors, dart:isolate). But this gets tricky when its actually individual APIs within those libraries which are required.
Specifically in this case it's
Isolate.resolvePackageUri, but also things likedart:mirrorswork. There might also be others although I am not sure. Mirrors is of course experimental still, butIsolate.resolvePackageUriis stable. But afaik the VM is the only environment that supports every API (except the web ones).