Saturday, March 25, 2023
HomeSoftware EngineeringThe best way to Uninstall npm packages

The best way to Uninstall npm packages

We usually set up an npm package deal as follows:

npm set up <package_name>

However how will we uninstall an npm package deal?

The best way to uninstall an npm package deal

This can uninstall an npm package deal that was put in in your challenge.

Simply be sure that to run the command from the foundation listing of your challenge.

npm uninstall <package_name>

This can take away the package deal from the node_modules listing and also will take away the reference to it from the package deal.json file.

The best way to uninstall a devDependency

You probably have a package deal put in within the devDependency part of your package deal.json, then you may uninstall it as follows:

npm uninstall -D <package_name>

The best way to uninstall a world npm package deal

Generally we set up npm packages globally, in order that we are able to use them as command-line instruments, or if we would like them accessible to all tasks.

This may be achieved as follows:

npm uninstall -g <package_name>

You might also ask these questions

What occurs if I uninstall npm?

If you uninstall npm you’re eradicating packages which have beforehand been put in by the npm set up or npm i instructions.

How do I uninstall npm alone?

If you want to uninstall a selected npm package deal, then run the next command:

npm uninstall <package_name>

How uninstall npm react?

If you want to uninstall a Take away Create React App:

# npm
npm uninstall -g create-react-app

# yarn
yarn international take away create-react-app

How do I uninstall and reinstall node and npm?

Delete the node and npm folders situated there:

# delete node folder
rm -rf  /usr/native/bin/node

# delete npm folder
rm -rf  /usr/native/bin/npm

As soon as each folders are deleted, you may reinstall node and npm utilizing the .pkg file for Mac.

In the event you set up Node utilizing Homebrew, then you should use brew command to uninstall it:

# uninstall node and npm
brew uninstall node

# set up it once more
brew set up node

If you’re utilizing Linux Ubuntu, then you may take away Node utilizing apt-get as proven under:

# uninstall node for Ubuntu
sudo apt-get take away node

# set up it once more
sudo apt-get set up node

In the event you don’t need to uninstall node, then you may attempt to obtain and set up npm instantly utilizing the set script from

Open the terminal and run the next command:

curl -qL | sh

Usually, if in case you have an present npm program put in already, the direct set up will fail as proven under:

$ curl -qL | sh

# ...
# fetching:
# eradicating present npm
# failed!

Appears npm direct set up received’t work for some purpose.

It’s essential add the sudo command to the sh pipe as proven under:

curl -qL | sudo sh

In the event you’re utilizing ZSH, you may even see the command above suspended like this:

# zsh: suspended (tty enter) sudo sh

When that occurs, attempt to obtain the set script first, then run it utilizing the sudo command as follows:

# obtain set
curl -O

# run the script utilizing sudo
sudo sh set

# after set up full, take away the script
rm set


Please enter your comment!
Please enter your name here

Most Popular

Recent Comments