When working on multiple projects, it can be difficult to keep track of which package manager is being used, whether it's npm, yarn, or pnpm. This is where the ni
package manager comes in handy. ni
is a lightweight and efficient package manager that simplifies the management of dependencies in Node.js projects.
Installing
To get started with ni, you need to install it globally on your system using npm. You can do this by running the following command in your terminal
npm i -g @antfu/ni
The ni
command is used to install packages, and it supports various flags that allow you to install packages globally or install specific versions of packages. For example, if you want to install the React package, you can simply run:
ni react
To install the package globally
ni -g eslint
nr
This command is used to run scripts in a project, it will run scripts according to the package manager used in your project. To use it, use the following command
nr start
or just run the nr
command to select between all available scripts.
nu
This command is used to upgrade packages, and it supports interactive upgrades, allowing you to select which packages to upgrade and to which version.
# Equivalent to npm upgrade
nu
nun
This command is used to uninstall packages using the package manager of your project.
nun react
Overall, ni
is a powerful and versatile package manager tool that simplifies the management of dependencies in Node.js projects. It helps you to save time during the development process.
I hope this article is helpful to you. If you like this article share it with others.