Tips on how to Uninstall npm packages

We usually set up an npm bundle as follows:

npm set up <package_name>

However how can we uninstall an npm bundle?

Tips on how to uninstall an npm bundle

This may uninstall an npm bundle that was put in in your challenge.

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

npm uninstall <package_name>

This may take away the bundle from the node_modules listing and also will take away the reference to it from the bundle.json file.

Tips on how to uninstall a devDependency

You probably have a bundle put in within the devDependency part of your bundle.json, then you’ll be able to uninstall it as follows:

npm uninstall -D <package_name>

Tips on how to uninstall a world npm bundle

Typically 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 initiatives.

This may be achieved as follows:

npm uninstall -g <package_name>

You may additionally ask these questions

What occurs if I uninstall npm?

While 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 need to uninstall a selected npm bundle, then run the next command:

npm uninstall <package_name>

How uninstall npm react?

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

# npm
npm uninstall -g create-react-app

# yarn
yarn world 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’ll be able to reinstall node and npm utilizing the .pkg file for Mac.

See also  Technical Enterprise Capital with Tim Tully

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

# uninstall node and npm
brew uninstall node

# set up it once more
brew set up node

In case you are utilizing Linux Ubuntu, then you’ll be able to take away Node utilizing apt-get as proven beneath:

# 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’ll be able to 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, you probably have an present npm program put in already, the direct set up will fail as proven beneath:

$ 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 beneath:

curl -qL | sudo sh

In the event you’re utilizing ZSH, you might 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

Leave a Reply