Node.js: Instalasi

From Catatan IBM
Revision as of 06:17, 20 June 2023 by Ibm (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Bahan praktek menggunakan Ubuntu 20.04

Instalasi melalui Package Manager (APT)

di ubuntu 20.04 versi node.js saat ini adalah 10.19.0 dan NPM (Node Package Manager) 6.14.4

Update repo

sudo apt update && sudo apt upgrade

Install

sudo apt install nodejs

Install npm

sudo apt install npm

Selesai. untuk melihat versi node.js dan npm dengan perintah

nodejs -v
npm -v


Instalasi melalui PPA (Personal Package Archive)

Untuk melalui PPA, versi terbaru saat ini adalah 16.3.0 dan versi LTS nya adalah 14.17.0

Install curl terlebih dahulu

sudo apt install curl

Install Node.js LTS Latest (v14.x)

cd ~ | curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

Install Node.js Current Latest (v16.x)

cd ~ | curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -

Install Node.js dengan versi spesifik (v12.x misalnya)

cd ~ | curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  • Sebagai catatan bahwa perintah ini sudah sekalian install NPM

Setelah proses diatas selesai, Install Node.js

sudo apt install nodejs

Melihat versi Node.js dan npm

node -v && npm -v

Selesai


Menghapus Node.js dari Ubuntu

Uninstall dari system

sudo apt-get remove nodejs

Hapus paket dan konfigurasinya

sudo apt-get purge nodejs

Terakhir, hapus file-file yang tidak berguna dan free up disk space

sudo apt-get autoremove

Selesai