check current node.js version

node -v
node --version

clean npm cache

sudo npm cache clean -f

install n

sudo npm install -g n

upgrade to stable version

sudo n stable