2

i am new in linux and want install node with bellow command:

sudo apt-get install curl

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

sudo apt-get install nodejs

and angular 8 needs node 12.x

i remove node with sudo apt-get purge --auto-remove nodejs and run bellow command but it installed perverse version

sudo apt-get install curl curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install nodejs

3 Answers3

2
  1. curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

  2. sudo apt install nodejs

  3. Check: $ node --version Output: v10.16.3

  4. Check: $ npm --version Output: 6.9.0

0

Try using n. After installing node in any way, eg. as described below:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

you should have npm available. Install n with:

npm install -g n

and select correct version

  • n lsr to list available versions
  • n latest to use latest
  • n 12.0.0 to use 12.0
kubahaha
  • 1,167
-1

Try the following command

sudo n lts

if you want to install update version then run command

sudo install n16.15.1

This work for me fine.