Skip to content

Instantly share code, notes, and snippets.

@samiron
Created July 4, 2023 17:21
Show Gist options
  • Save samiron/450dbbcb2fb79f0e1195709f0899dd8f to your computer and use it in GitHub Desktop.
Save samiron/450dbbcb2fb79f0e1195709f0899dd8f to your computer and use it in GitHub Desktop.
node project
#!/bin/bash
set -e
while true; do
log="$HOME/.npm/_logs/`ls $HOME/.npm/_logs/ | tail -n 1`"
echo "log: $log"
for path in `cat "$log" | grep 'ENOTEMPTY' | grep -oE "[^']+node_modules[^']+"`; do
echo "removing $path"
rm -rf "$path"
done
if npm install; then
break
fi
done
# Copied from https://stackoverflow.com/a/74413191/1160106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment