In this tutorial, we are going to learn about how to reinstall npm packages and its dependencies that are present inside the
package.json file of your project.
To reinstall all npm packages and their dependencies follow the below steps:
- Navigate to the project directory in your terminal.
- Delete the
node_modulesfolder by running the following command.
rm -rf node_modules
- Now, run the
npm installcommand to download all packages from the npm.
To reinstall a single npm package:
- First, uninstall the package by running the
npm uninstallcommand followed by the
npm uninstall react
react is the package name.
- Install the package again by running the
npm installcommand followed by the
npm install react