Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set specific version of node as default using n

Tags:

node.js

npm

I've installed node using the npm by below commands.

  sudo npm cache clean -f
  sudo npm install -g n
  sudo n 8

sudo n 8 installed node 8 .

$ sudo n 8
 install : node-v8.11.3
   mkdir : /usr/local/n/versions/node/8.11.3
   fetch : https://nodejs.org/dist/v8.11.3/node-v8.11.3-darwin-x64.tar.gz
   ######################################################################## 100.0%
  installed : v6.13.1

but didn't set it as default

 $ node -v
 v6.13.1

How can I set node version 8 as default node version.

like image 558
Rajkumar Natarajan Avatar asked Aug 06 '18 22:08

Rajkumar Natarajan


1 Answers

You still need to activate the installed version, installing doesn't automatically switch to that version. Type n after doing the install and select the version you want. From that point forward, it will be the node version your system uses. You may need to use sudo n if you run into permission issues.

like image 180
peteb Avatar answered Nov 15 '22 03:11

peteb