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

Mohsen Saleh
  • 21
  • 1
  • 6
  • 2
    Which version of Linux are you using? Which release number? Please help us help you by providing that information. Please put that into your question by clicking [edit]. Don't use Ask Comment; instead, click [edit]. – K7AAY Oct 17 '19 at 21:33
  • Does this answer your question? [How do I install the latest version of node.js?](https://askubuntu.com/questions/49390/how-do-i-install-the-latest-version-of-node-js) – karel Sep 16 '20 at 12:21

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,157
  • 8
  • 20
-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.