Created
March 6, 2017 14:20
-
-
Save aendra-rininsland/cf153aeba6ca414219b47e7955beb75d to your computer and use it in GitHub Desktop.
Simple bash script that attempts to fix NodeJS using n via Homebrew on OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Running Ændrew's Node Fixer Script" | |
if (( $(stat -f %u /usr/local) == 0)); then | |
echo "Fixing /usr/local permissions" | |
sudo chown -R $USER:"$(id -gn)" /usr/local | |
fi | |
echo "Install Node LTS" | |
if hash n 2>/dev/null; then | |
n lts | |
else | |
echo "You need to install n" | |
if hash brew 2>/dev/null; then | |
brew update && brew install n | |
n lts | |
else | |
echo "You also need to install Homebrew" | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
if hash xcode-select 2>/dev/null; then | |
brew update && brew install n | |
n lts | |
else | |
echo "You *ALSO* need to install XCode, which is more than I can do" | |
echo "Please talk to somebody in #graphics-dev!" | |
fi | |
fi | |
fi | |
echo "Installing latest npm" | |
npm i -g npm@latest | |
echo "Done! Try what you were doing before again. :)" | |
echo "Any problems? Give @andrew.rininsland a shout!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment