Saturday, June 3, 2023
HomeSoftware EngineeringLearn how to Uninstall npm packages

Learn how to Uninstall npm packages

We sometimes set up an npm bundle as follows:

npm set up <package_name>

However how will we uninstall an npm bundle?

Learn how to uninstall an npm bundle

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

Simply make sure that to run the command from the basis listing of your undertaking.

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.

Learn how to uninstall a devDependency

When you’ve got a bundle put in within the devDependency part of your bundle.json, then you possibly can uninstall it as follows:

npm uninstall -D <package_name>

Learn how to uninstall a worldwide 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 tasks.

This may be achieved as follows:

npm uninstall -g <package_name>

You may additionally ask these questions

What occurs if I uninstall npm?

If you uninstall npm you might be 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 particular npm bundle, 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 positioned 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 possibly can reinstall node and npm utilizing the .pkg file for Mac.

If you happen to 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 possibly can 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

If you happen to don’t need to uninstall node, then you possibly can attempt to obtain and set up npm straight utilizing the set script from

Open the terminal and run the next command:

curl -qL | sh

Usually, when you’ve got 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 gained’t work for some motive.

You have to add the sudo command to the sh pipe as proven under:

curl -qL | sudo sh

If you happen to’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