Skip to content

Instantly share code, notes, and snippets.

@backviet
Last active March 19, 2022 17:29
Show Gist options
  • Save backviet/fb26f5e0c10adb734d391121638fcca6 to your computer and use it in GitHub Desktop.
Save backviet/fb26f5e0c10adb734d391121638fcca6 to your computer and use it in GitHub Desktop.
npm helper
#!/usr/bin/env bash
echo "current version $(node --version)"
currpath=$PWD
cd /usr/local/include
rm -R node
cd /usr/local/lib
rm -R node_modules
cd /usr/local/bin
rm -R node
echo "Done"
cd $currpath
#!/usr/bin/env bash
# This to fix bellow error:
# npm ERR! code ERR_SOCKET_TIMEOUT on creating new project using ng new appname
# https://stackoverflow.com/questions/67657599/npm-err-code-err-socket-timeout-on-creating-new-project-using-ng-new-appname
# npm cache clear --force
echo "old npm configs"
npm config ls -l
npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000
echo "new npm config"
npm config ls -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment