-
Notifications
You must be signed in to change notification settings - Fork 229
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
Pub global activate with local path sometimes has no effect #4295
Comments
This sounds like a bug. Not sure how it can happen. Any help you can give with reproducing this would be nice. If you could attach the output of running |
Ok, I'll have to wait until it randomly happens again. |
I seem to have the same issue.
which is expected (except for the dependencies issues) Run sfdk_cli --version The activate source doesn't seem to do anything anymore since I updated to Flutter latest stable version UPDATE: I'm adding the pub_log.txt linked to my last activate test. |
@sigurdm ⏫ |
Weird. The attached log says Not sure what to make of this... |
Oh sorry, Yes let me explain. The log file I shared is from my actual package. |
Sorry, I'm not following. Did you manage to reproduce in the blank project? |
Yes I did, @sigurdm . No matter which project, whether a fully-fledged one or a blank one, I have the same issue. |
I just ran into this again. I discovered that I have to delete the When I delete the
If I don't delete the Specifically, within the |
We at Serverpod (and contributors to our framework) are experiencing the same issue. This is usually my workaround: On Mac, I can find out where the cached binary is stored by running:
And then manually remove the file |
With macOs I have the same issue. I update my dart tool with, the following command, but it doesn't work. dart pub global activate --source path . --overwrite When I run my tool it's actually a shell script, that will be executed and the content makes clear, that if there is a snapshot with the current dart version, the snapshot will be executed instead of the latest version from the source directory. # /Users/<user>/.pub-cache/bin/<tool>
# The content of the script is
if [ -f /Users/<user>/src/<tool>/bin/main.dart-3.5.2.snapshot ]; then
dart "/Users/<user>/src/<tool>/bin/main.dart-3.5.2.snapshot" "$@"
# The VM exits with code 253 if the snapshot version is out-of-date.
# If it is, we need to delete it and run "pub global" manually.
exit_code=$?
if [ $exit_code != 253 ]; then
exit $exit_code
fi
dart pub -v global run <tool>:<tool> "$@"
else
dart pub global run <tool>:<tool> "$@"
fi Deleting the old snapshot was also my first approach, but it's also possible to run the tool via So my current workaround to update the tool is: dart pub global activate --source path . --overwrite
dart pub global run <tool>:<tool> My guess why the bug does not always occur: After updating the dart vm, the first run of the tool will create a new snapshot. However, a second attempt to update the tool fails. I would expect, that |
Environment
dart --version
):macOS 14.3.1
No
Problem
I maintain a CLI package. There's the published version on Pub, and then there's version that I work on locally.
When I want to activate the Pub version, I use
dart pub global activate static_shock_cli
.When I want to activate the local version, I set the current working directory to where that package is defined and then I run
dart pub global activate --source=path .
Expected behavior
When I activate the local version, the local version should run when I issue commands.
Actual behavior
The Pub version continue to be run when I try execute commands.
Details
On a seemingly random basis, I'm unable to effectively activate my local version. There's no error when I try to activate my local version. The output suggests success. However, when I go to run the tool, it clearly doesn't have any of my local changes - it's still running the version from Pub.
When this happens, I also explicitly run
dart pub global deactivate static_shock_cli
before then trying again to activate the local version. This has no effect. Pub somehow still ends up executing the Pub version, which I just told it to deactivate.I've discovered that if I delete all the references I can find in my Pub cache for this package, then I can get Pub to truly activate my local version. But that's the level of intervention it seems to take to get this working.
One final detail is that I primarily work with Flutter. That's where my Dart distribution comes from. I occasionally switch between the
master
branch andstable
branch of Flutter. It's possible that at times I end up activating the local version of my CLI package when I'm onmaster
and other times onstable
. However, if my local package isn't activating, and I realize that I'm onmaster
, even if I then switch tostable
, the problem persists. The only way out seems to be to manually delete directories out of the pub cache.The text was updated successfully, but these errors were encountered: