Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No active package pub #4225

Open
denniskaselow opened this issue Apr 16, 2024 · 13 comments
Open

Error: No active package pub #4225

denniskaselow opened this issue Apr 16, 2024 · 13 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@denniskaselow
Copy link

denniskaselow commented Apr 16, 2024

Environment

Dart SDK version: 3.5.0-43.0.dev (dev) (Tue Apr 9 21:04:06 2024 -0700) on "windows_x64"

Problem

Trying to run melos bootstrap or jaspr serve I get the following error: No active package pub

pub_log.txt has this:

Pub version: 3.5.0-43.0.dev
Created: 2024-04-16T06:13:25.255390
FLUTTER_ROOT: <not set>
PUB_HOSTED_URL: <not set>
PUB_CACHE: "<not set>"
Command: dart pub global run pub global 'activate:jaspr' serve --verbose
Platform: windows

The Command looks strange, trying to dart pub global run pub global. Maybe related to this change ed20b45 ?

---- Log transcript ----
FINE: Pub 3.5.0-43.0.dev
ERR : No active package �[1mpub�[0m.
FINE: Exception type: DataException
FINE: package:pub/src/utils.dart 583:36                      dataError
    | package:pub/src/global_packages.dart 379:7             GlobalPackages.find
    | package:pub/src/command/global_run.dart 76:44          GlobalRunCommand.runProtected
    | package:pub/src/command.dart 197:21                    PubCommand.run.<fn>
    | dart:async                                             new Future.sync
    | package:pub/src/utils.dart 137:12                      captureErrors.wrappedCallback
    | package:stack_trace                                    Chain.capture
    | package:pub/src/utils.dart 154:11                      captureErrors
    | package:pub/src/command.dart 196:13                    PubCommand.run
    | package:args/command_runner.dart 212:27                CommandRunner.runCommand
    | package:dartdev/dartdev.dart 236:30                    DartdevRunner.runCommand
    | package:args/command_runner.dart 122:25                CommandRunner.run.<fn>
    | dart:async                                             new Future.sync
    | package:args/command_runner.dart 122:14                CommandRunner.run
    | package:dartdev/dartdev.dart 47:29                     runDartdev
    | C:\b\s\w\ir\x\w\sdk\pkg\dartdev\bin\dartdev.dart 12:9  main
    | ===== asynchronous gap ===========================
    | dart:async                                             Future.catchError
    | package:pub/src/utils.dart 139:10                      captureErrors.wrappedCallback
    | package:stack_trace                                    Chain.capture
    | package:pub/src/utils.dart 154:11                      captureErrors
    | package:pub/src/command.dart 196:13                    PubCommand.run
    | package:args/command_runner.dart 212:27                CommandRunner.runCommand
    | package:dartdev/dartdev.dart 236:30                    DartdevRunner.runCommand
    | package:args/command_runner.dart 122:25                CommandRunner.run.<fn>
    | dart:async                                             new Future.sync
    | package:args/command_runner.dart 122:14                CommandRunner.run
    | package:dartdev/dartdev.dart 47:29                     runDartdev
    | C:\b\s\w\ir\x\w\sdk\pkg\dartdev\bin\dartdev.dart 12:9  main
---- End log transcript ----

EDIT: Manually running dart pub global run melos bootstrap instead of melos bootstrap and dart pub global run jaspr_cli:jaspr serve instead of jaspr serve works as a workaround.

@denniskaselow
Copy link
Author

Got both commands to run again by running:

dart pub global deactivate melos
dart pub global activate melos --overwrite

and

dart pub global activate jaspr_cli --overwrite

Doing it for jaspr like for melos did not work, had to use jaspr_cli.

@sigurdm
Copy link
Contributor

sigurdm commented Apr 16, 2024

Ouch - #4205 was supposed to fix this issue.

Could it be that the binstub with the problem was created by an earlier dev release of SDK?

@sigurdm sigurdm added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) needs-info Additional information needed from the issue author labels Apr 16, 2024
@denniskaselow
Copy link
Author

denniskaselow commented Apr 16, 2024

It's possible. I just downgraded to Dart Stable 3.3.3, deactivated and overwrote melos and then went back to the current Dart dev version and it did

Can't load Kernel binary: Invalid kernel binary format version.
Building package executable... (2.3s)
Built melos:melos.

just fine. So it seems to work and I just had a broken state?

The only weird thing was, that the run ended (but only the first run) with

'los' is not recognized as an internal or external command, operable program or batch file.

but that didn't seem to do anything negative.

@sigurdm
Copy link
Contributor

sigurdm commented Apr 16, 2024

So it seems to work and I just had a broken state?
Yes, dev releases pre-merging of #4205 could lead to this broken state.

deactivating and reactivating of the affected global package should fix it.

I'll close this issue as fixed- but please comment if I have overseen something.

@denniskaselow
Copy link
Author

denniskaselow commented Apr 16, 2024

The only remaining weird thing is the message after first running the program after moving from stable to dev. Happens with all packages I have installed (but only after the first run, the message doesn't appear in later runs):

melos:

'los' is not recognized as an internal or external command, operable program or batch file.

jaspr:

'spr' is not recognized as an internal or external command, operable program or batch file.

pana:

'ana' is not recognized as an internal or external command, operable program or batch file.

But it doesn't break anything as far as I can tell.

@github-actions github-actions bot removed the needs-info Additional information needed from the issue author label Apr 17, 2024
@craiglabenz
Copy link

I also ran into this issue and was seemingly only able to fix it with the --overwrite flag after deactivating.

@craiglabenz
Copy link

craiglabenz commented Apr 20, 2024

I've run into this again, this time on my personal machine, and this time cycling the package and using --overwrite during reinstallation is not helping.

I'm on the master channel, and $ flutter doctor is hanging, but when I kill the command I at least get this output:

$ flutter doctor -v
[✓] Flutter (Channel master, 3.22.0-14.0.pre.56, on macOS 14.2.1 23C71
    darwin-arm64, locale en-US)
    • Flutter version 3.22.0-14.0.pre.56 on channel master at
      /Users/craiglabenz/Dev/git/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision babc722438 (58 minutes ago), 2024-04-19 20:34:25 -0400
    • Engine revision 3db86b3cab
    • Dart version 3.5.0 (build 3.5.0-81.0.dev)
    • DevTools version 2.35.0-dev.8

@craiglabenz
Copy link

craiglabenz commented Apr 20, 2024

This time around, I solved the issue by deleting my .pub-cache/ directory and reinstalling the global pub dependency. Both times, (on my work and personal machines), I first encountered the error while upgrading a dependency like this:

$ dart pub global activate serverpod

The full error message I saw was:

$ serverpod create project
Can't load Kernel binary: Invalid kernel binary format version.
No active package pub.

@denniskaselow
Copy link
Author

You probably had to overwrite serverpod_cli like I had to do it with jaspr and jaspr_cli.

No idea why flutter doctor hangs/hung as I'm not using flutter.

@sigurdm
Copy link
Contributor

sigurdm commented Apr 22, 2024

@craiglabenz was the serverpod package originally activated with an older dev-release or with the 3.5.0-81.0.dev one?
I think that the bug is fixed such that pub should no longer create faulty binstubs. But it will still fail if it encounters a faulty binstub.

Do we think that flutter doctor hanging has anything to do with pub??

@craiglabenz
Copy link

craiglabenz commented Apr 22, 2024

@sigurdm The older serverpod package was almost certainly activated with an older release, since I update at least weekly. Would it make sense to nuke and recreate a binstub when it encounters an error?

This bug was pretty hard to get around. In fact I was actually hard blocked until I asked Flutter teammates and was directed to this bug. Googling "No active package pub" didn't even find this issue - it actually returned zero results. So - improving the tool to self-correct faulty binstubs could be valuable :)

@sigurdm
Copy link
Contributor

sigurdm commented Apr 23, 2024

Yeah, removing faulty binstubs would not be a bad idea.

@sigurdm
Copy link
Contributor

sigurdm commented Apr 23, 2024

Filed #4235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants