Using npm, how do you uninstall a package?

Experience Level: Junior
Tags: npm

Answer

If you want to uninstall a local npm package, open a command-line, go to your project directory that contains a file package.json and run the following command:

npm uninstall <package-name>

To uninstall a global npm package, open a command-line, go to your project directory that contains a file package.json and run the following command:

npm uninstall -g <package-name>
Related npm job interview questions
npm for beginners
npm for beginners

Are you learning npm? Try our test we designed to help you progress faster.

Test yourself