Skip to content

Instantly share code, notes, and snippets.

@dominhhai
Created April 23, 2016 00:32
Show Gist options
  • Save dominhhai/a767b55e460125ea9c267f74d3868ea1 to your computer and use it in GitHub Desktop.
Save dominhhai/a767b55e460125ea9c267f74d3868ea1 to your computer and use it in GitHub Desktop.
Update node & npm bash
#! /bin/bash
# node update
echo 'update node.js...'
echo 'current node version:'
node -v
echo 'clean npm cache...'
sudo npm cache clean -f
echo 'update n...'
sudo npm install -g n
echo 'update node...'
sudo n stable
echo 'updated node. Current version is:'
node -v
# npm update
echo 'update npm...'
echo 'current npm version:'
npm -v
sudo npm install -g npm
echo 'updated npm. Current version is:'
npm -v
@dominhhai
Copy link
Author

dominhhai commented Apr 23, 2016

  1. add permission:
chmod 777 n.sh
  1. do update
./n.sh

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