How to Delete node_modules and Run a Clean App

To start from scratch by removing the node_modules directory and running a clean app, follow these steps:

Delete node_modules

From your terminal, navigate to your project root directory and run:

# Remove node_modules directory
rm -rf node_modules
# Clear npm cache
npm cache clean --force

Reinstall dependencies

# Install all dependencies from package.json
npm install

Run the app

After reinstalling dependencies, you can run your app:

# Start the app
npm start

Or if you’re in development mode:

# Run in development mode with auto-reload
npm run dev

This process ensures you have a clean installation of all dependencies, which can help resolve issues caused by corrupted or outdated packages.