pkgxdev / pkgx

run anything
https://pkgx.sh
Apache License 2.0
9k stars 1.36k forks source link

`pkgx uninstall` fails if pantry is not downloaded yet #1004

Open felipecrs opened 6 months ago

felipecrs commented 6 months ago

I believe it should download the pantry on the fly.

❯ docker run --rm -it --entrypoint= ghcr.io/felipecrs/devcontainer:2 pkgx uninstall volta
× pantry error pantry not found: /home/devcontainer/.local/share/pkgx/pantry/projects
│
╰─➤ https://docs.pkgx.sh/help/pantry-error
dosubot[bot] commented 6 months ago

To address the issue where pkgx uninstall fails due to the pantry not being downloaded, you can precede the uninstall command with pkgx --sync. This command ensures the pantry is updated and any necessary packages are downloaded, thus avoiding the pantry error. Here's how you can integrate this into your workflow:

  1. Before attempting to uninstall with pkgx, run:
    pkgx --sync
  2. Once the pantry is synced, proceed with your uninstall command as initially intended.

This approach leverages pkgx's functionality to keep the pantry up to date, ensuring smooth package management operations without encountering errors related to missing pantry data.

#### Details **Sources** - [src/modes/uninstall.ts](https://github.com/pkgxdev/pkgx/blob/main/src/modes/uninstall.ts) - [docs/pantry.md](https://github.com/pkgxdev/pkgx/blob/main/docs/pantry.md) - [docs/run/anywhere/docker.md](https://github.com/pkgxdev/pkgx/blob/main/docs/run/anywhere/docker.md) - [fixtures/pkgx.yml](https://github.com/pkgxdev/pkgx/blob/main/fixtures/pkgx.yml) - [.github/Dockerfile](https://github.com/pkgxdev/pkgx/blob/main/.github/Dockerfile) - [src/prefab/failsafe.ts](https://github.com/pkgxdev/pkgx/blob/main/src/prefab/failsafe.ts) - [src/err-handler.ts](https://github.com/pkgxdev/pkgx/blob/main/src/err-handler.ts) - [src/utils/error.ts](https://github.com/pkgxdev/pkgx/blob/main/src/utils/error.ts)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.