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

how to upgrade package manager itself #161

Closed
3 tasks done
Lionad-Morotar opened this issue Jun 27, 2023 · 4 comments
Closed
3 tasks done

how to upgrade package manager itself #161

Lionad-Morotar opened this issue Jun 27, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Lionad-Morotar
Copy link

Lionad-Morotar commented Jun 27, 2023

Clear and concise description of the problem

I would like to upgrade pnpm before installing it. It would be nice if I could use the command npx @antfu/ni upgrade self to upgrade the version of pnpm on my CI instead npm install -g pnpm

Suggested solution

  1. npx @antfu/ni upgrade self

Alternative

if [[ -f "pnpm-lock.yaml" ]]; then
   npm install -g pnpm
fi;

Validations

@Lionad-Morotar Lionad-Morotar added the enhancement New feature or request label Jun 27, 2023
@antfu
Copy link
Member

antfu commented Jun 28, 2023

ni -g pnpm like this?

I would suggest using https://github.com/antfu/contribute#corepack so you don't even need to worry about that

@antfu antfu closed this as completed Jun 28, 2023
@Lionad-Morotar
Copy link
Author

ni -g pnpm like this?

I would suggest using antfu/contribute#corepack so you don't even need to worry about that

The only slightly inconvenient aspect is that if I don't use Corepack or other tools to lock the package manager version, I can only manually determine which package manager is being used to perform global installation and upgrades, for example:

if [[ -f "pnpm-lock.yaml" ]]; then
   npm install -g pnpm
elif [[ -f "package-lock.json" ]]; then
   npm install -g npm
fi;

em... what should I do in this situation? Thank you!

@antfu
Copy link
Member

antfu commented Jun 28, 2023

Use run npm install -g pnpm && npm install -g npm && npm install -g yarn - it's not that hard. I don't think it's belong to the scope of this project.

@Lionad-Morotar
Copy link
Author

Lionad-Morotar commented Jun 28, 2023

This is a good approach, but there are situations where it is not possible to update the versions of both npm and other package managers simultaneously #5621. Therefore, I am looking for a tool that can call the package manager to solve this problem, and I am still looking for possible answers. Thank you for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants