Skip to content

Instantly share code, notes, and snippets.

@jsdario
Last active December 12, 2023 08:36
Show Gist options
  • Save jsdario/5f4b0320d4cacb599553ed162563640a to your computer and use it in GitHub Desktop.
Save jsdario/5f4b0320d4cacb599553ed162563640a to your computer and use it in GitHub Desktop.
Script to clean watchman, remove node_modules, clean cache and restart packager for React Native troubleshooting.
#!/bin/bash
# Stop cached listeners
watchman watch-del-all
# Remove installed modules
rm -rf node_modules
# Remove yarn meta files
rm yarn*
# Install only fresh copies
yarn cache clean
yarn
# Kill any other instance of the packager
lsof -ti:8081 | xargs kill
# Restart the thing
npm start --reset-cache
@aymather
Copy link

Can you please provide some quick documentation on how/when to use this?

@jsdario
Copy link
Author

jsdario commented Sep 4, 2019

It's just an sh script, so add this file to your repo and run bash nuke-deps.sh from your command line. You can also add this as a npm script and run npm run nuke-deps or yarn nuke-deps.

@gax97
Copy link

gax97 commented Dec 18, 2020

rm yarn* - Also deletes yarn.lock. Not sure if that should be the case when troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment