# Node.js Upgrade Guide

## Problem
Next.js requires Node.js version >=20.9.0, but you're using Node.js 18.19.1.

## Solution: Install Node.js 20 using NVM

### Step 1: Install NVM (if not already installed)
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
```

### Step 2: Reload your shell
```bash
source ~/.bashrc
# or
source ~/.zshrc
```

### Step 3: Install Node.js 20
```bash
nvm install 20
nvm use 20
nvm alias default 20
```

### Step 4: Verify
```bash
node --version  # Should show v20.x.x
npm --version
```

### Step 5: Run Next.js
```bash
cd plagis-nextjs
npm run dev
```

## Alternative: Direct Node.js Installation

If you prefer not to use NVM:

### Ubuntu/Debian:
```bash
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
```

### Or download from:
https://nodejs.org/en/download/

## Quick Fix Script

Run this to set up Node.js 20:

```bash
# Add to ~/.bashrc for persistence
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# Then in your terminal:
nvm install 20
nvm use 20
nvm alias default 20
```

## Verify Installation

After installation, verify:
```bash
node --version  # Should be >= 20.9.0
npm --version
```

Then try running Next.js again:
```bash
cd plagis-nextjs
npm run dev
```

