DEV Community

Vivek
Vivek

Posted on

Ni, one solution for all Nodejs package manager

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

To install package globally

ni -g eslint
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

or just run the nr command to select between all available scripts.

demo img

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.

nu
Enter fullscreen mode Exit fullscreen mode

nun

This command is used to uninstall packages using the package manager of your project.

nun react
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)