sdk icon indicating copy to clipboard operation
sdk copied to clipboard

'pub' is not recognized as an internal or external command

Open timsneath opened this issue 5 years ago • 10 comments

After running flutter upgrade on Windows:

Flutter 1.22.0-10.0.pre.179 • channel master • [email protected]:flutter/flutter.git
Framework • revision e55b7ca0a3 (7 minutes ago) • 2020-09-15 19:10:33 +0200
Engine • revision c6121c5d51
Tools • Dart 2.10.0 (build 2.10.0-124.0.dev)

Running flutter doctor...
Downloading android-arm-profile/windows-x64 tools...                0.7s
Downloading android-arm-release/windows-x64 tools...                0.5s
Downloading android-arm64-profile/windows-x64 tools...              0.3s
Downloading android-arm64-release/windows-x64 tools...              0.4s
Downloading android-x64-profile/windows-x64 tools...                0.6s
Downloading android-x64-release/windows-x64 tools...                0.3s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.22.0-10.0.pre.179, on Microsoft Windows [Version 10.0.19041.488], locale en-US)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.2)
[!] Android Studio (not installed)
[✓] VS Code (version 1.49.0)
[✓] Connected device (4 available)

! Doctor found issues in 1 category.
[C:\src\win32] dartdoc
Can't load Kernel binary: Invalid kernel binary format version.
'pub' is not recognized as an internal or external command,
operable program or batch file.

timsneath avatar Sep 15 '20 17:09 timsneath

@mit-mit Is this by design?

timsneath avatar Sep 15 '20 17:09 timsneath

Can you run where dartdoc to determine which dartdoc that is? I'm curious if it's the one in bin, or one you pub globally activated.

My theory is that it's the latter. @jonasfj did we resolve the issues where older activated apps couldn't run anymore?

mit-mit avatar Sep 16 '20 07:09 mit-mit

@jonasfj did we resolve the issues where older activated apps couldn't run anymore?

Yes, they still print an ugly message the first time they are recompiled..

But, I don't think globally activated things have worked with flutter. I think the flutter pub global run ... might work, but the part where you add them to PATH is unlikely to work. Notably, because pub isn't in PATH either.

Now that flutter is starting to ship dart in PATH and we have dart pub we probably could fix this.

jonasfj avatar Sep 16 '20 08:09 jonasfj

Yeah, I think this needs fixing.

I also missed that there was one in the bin/ folder still. Is that coming to the dart command any time soon? That is, dart doc?

On Wed, Sep 16, 2020 at 1:58 AM Jonas Finnemann Jensen < [email protected]> wrote:

@jonasfj https://github.com/jonasfj did we resolve the issues where older activated apps couldn't run anymore?

Yes, they still print an ugly message the first time they are recompiled..

But, I don't think globally activated things have worked with flutter. I think the flutter pub global run ... might work, but the part where you add them to PATH is unlikely to work. Notably, because pub isn't in PATH either.

Now that flutter is starting to ship dart in PATH and we have dart pub we probably could fix this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/sdk/issues/43434#issuecomment-693272240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARWL6YNZ3JWDCFZUKSSHSLSGB42LANCNFSM4RNO2U7A .

timsneath avatar Sep 18 '20 20:09 timsneath

Filed https://github.com/dart-lang/pub/issues/2663 to track fixes needed for flutter pub global run ...

jonasfj avatar Sep 23 '20 11:09 jonasfj

I wonder if we should consider not supporting global commands at all with flutter pub now that we have dart pub in path? wdyt @csells?

mit-mit avatar Sep 23 '20 12:09 mit-mit

I'll correct the problem statement, if you are using flutter pub global activate <package> or dart pub global activate <package> where dart is from a Flutter SDK, AND you have added $PUB_CACHE/bin to $PATH, then when upgrading the bin-stubs placed in your PATH will stop working.

The problem isn't specific to flutter pub global activate, it's specific to global activate in a context where pub is no longer in PATH, which is the case if you get the Dart SDK by installing a Flutter SDK.


An argument could be made that we should do away with the aspect of pub global activate where a bin-stub is placed into PATH. Because while it's nice that we can do pub global activate mono_repo an then run mono_repo, it might be okay to have people write pub global run mono_repo, and require them to make their on aliases in shell if they want such. (currently, globally activated packages can install whatever aliases they desire, installing a bash executable in PATH might have negative side-effects, hehe)

jonasfj avatar Sep 23 '20 12:09 jonasfj

I wonder if we should consider not supporting global commands at all with flutter pub now that we have dart pub in path? wdyt @csells?

Since we have both 'dart pub' and 'flutter pub', I don't see us needing to add 'pub' to the PATH by default. There is a significant number of docs and samples that would need to be updated, however, many of which we don't control.

csells avatar Sep 23 '20 15:09 csells

I think this is obsolete. We don't ship a pub command anymore.

sigurdm avatar Mar 14 '24 10:03 sigurdm

Git default Git Bash environment makes global packages inaccessible.

ismanong avatar Oct 15 '24 16:10 ismanong

Closing as obsolete

sigurdm avatar Oct 21 '24 08:10 sigurdm

@ismanong not sure I understand what you mean. Could you open a new issue in https://github.com/dart-lang/pub/issues/new explaining what you are trying to do, and what doesn't work?

sigurdm avatar Oct 21 '24 08:10 sigurdm