DEV Community

Danyson
Danyson

Posted on

Set up NodeJs in global path in Ubuntu with simple steps

Step 1 :

Note : NodeJS v14 stable

sudo snap install node --classic
Enter fullscreen mode Exit fullscreen mode

Step 2 :

Configure npm to use the ~/.npm-global directory for global module:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
source ~/.profile
Enter fullscreen mode Exit fullscreen mode

Step 3 :

Update npm :

sudo npm install npm --global
Enter fullscreen mode Exit fullscreen mode

Top comments (0)