antfu-collective / ni

💡 Use the right package manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New installation method that does not rely on NPM, can be installed and upgraded independently.

baboon-king opened this issue · comments

Clear and concise description of the problem

When we use a Node version manager (such as nvm, fnm) and have multiple Node versions on our computer, installing @antfu/ni using npm i -g @antfu/ni will install it in the global package of the currently active npm. This can lead to several issues.

  1. When switching Node versions and running npm list -g, @antfu/ni will not be listed (although it can still be used as a global package). This can cause ambiguity.
  2. Updating @antfu/ni becomes problematic. Due to the switched Node version, the package does not exist, resulting in an inability to update it, requiring a reinstallation.

Suggested solution

Provide additional installation methods, similar to PNPM Using a standalone script

Alternative

When I use the standalone installation of PNPM to install (pnpm i @antfu/ni -g), @antfu/ni can achieve this effect, but it depends on the standalone installation of PNPM.

Additional context

No response

Validations

After all, ni is a node package and works for node package managers. The problem occurs to any globally installed packages, it's more like a limitation/design choice of Node.js and the Node version manager. I don't think we would do anything about it as this is how it works. Thanks for bringing this up tho.

After all, ni is a node package......

Ok. right!
Thank you for your reply and answer!