Progress4 / 11 (36%)
Wajib#4⏱ 5 menit

Install OpenCode

Install Node.js LTS & OpenCode, verifikasi.

Install OpenCode

Prasyarat

  • Node.js 18+ (sudah include npm)
  • Terminal (PowerShell Windows, Terminal Mac/Linux)
  • Internet

Cek Node.js

bash
node --version
npm --version

Harus keluar versi (contoh: v20.10.0 dan 10.2.3).


Belum Punya Node.js? Install LTS:

Windows (Pilih 1)

powershell
# Opsi 1: Winget (cepat)
winget install OpenJS.NodeJS.LTS

# Opsi 2: Chocolatey
choco install nodejs-lts

# Opsi 3: Manual - download di nodejs.org → pilih LTS → next-next-finish

macOS

bash
# Homebrew (recommended)
brew install node@20

# Atau manual download di nodejs.org

Linux (Ubuntu/Debian)

bash
# NodeSource (versi terbaru LTS)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# Atau package manager biasa
sudo apt update && sudo apt install nodejs npm

Restart terminal setelah install, lalu cek node --version.


Install OpenCode

bash
npm install -g opencode-ai

Tunggu beberapa menit.

Verifikasi

bash
opencode --version

Keluar versi = sukses.

Windows error execution policy? Jalankan PowerShell as Administrator:

powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Troubleshooting Cepat

| Error | Solusi | |-------|--------| | command not found | Restart terminal / tambah npm global bin ke PATH | | EACCES permission | npm config set prefix ~/.npm-global + tambah ke PATH | | Version lama | npm update -g opencode-ai |


Next: Jalankan OpenCode