# 📦 How to Install Packages in cPanel

## ✅ package.json EXISTS - You have it!

**Location:** `C:\Users\hp\Documents\rev1111111\package.json`

---

## 🎯 What You Need to Do:

### **STEP 1: Make Sure package.json is Uploaded**

1. **Go to cPanel** → **File Manager**
2. **Open:** `public_html` folder
3. **Check:** Do you see `package.json` in the file list?

**If YES:** ✅ Skip to Step 2

**If NO:** Upload it now:
- Click **Upload**
- Select: `C:\Users\hp\Documents\rev1111111\package.json`
- Upload it

---

### **STEP 2: Open cPanel Terminal**

1. **In cPanel, search for:** "Terminal"
2. **Click:** Terminal icon
3. **A black command window opens** ✅

---

### **STEP 3: Activate Node.js Environment**

**cPanel will show you a command** in the Node.js App section. It looks like:

```bash
source /home/username/nodevenv/public_html/18/bin/activate
```

**Copy that EXACT command** and paste it in Terminal, then press Enter.

**You'll see:** Your prompt changes (shows Node.js is active)

---

### **STEP 4: Navigate to Your App Folder**

```bash
cd /home/YOUR_USERNAME/public_html
```

**Replace `YOUR_USERNAME`** with your actual cPanel username

**Example:**
```bash
cd /home/rebrand123/public_html
```

Press Enter.

---

### **STEP 5: Verify package.json is There**

```bash
ls -la package.json
```

**You should see:** File details for package.json

**If you see "No such file":** package.json is not uploaded - go back to Step 1

---

### **STEP 6: Install All Packages**

```bash
npm install
```

**Press Enter and WAIT**

**What happens:**
- Downloads 500+ packages
- Takes 2-5 minutes
- Shows progress bars
- Lots of text scrolling

**When done, you'll see:**
```
added 500+ packages in 3m
```

✅ **Success!**

---

### **STEP 7: Build the Application**

```bash
npm run build
```

**Press Enter and WAIT**

**What happens:**
- Compiles TypeScript
- Optimizes code
- Takes 1-3 minutes

**When done, you'll see:**
```
✓ Compiled successfully
✓ Collecting page data
✓ Generating static pages
```

✅ **Success!**

---

## 🚀 After Installation

Go back to **Setup Node.js App** in cPanel:
1. Find your app
2. Click **Start App** or **Restart App**
3. Status should show **Running**

Visit: **https://rebrandlyai.com**

---

## 🐛 Troubleshooting

### **"npm: command not found"**

**Solution:** Run the activation command first:
```bash
source /home/username/nodevenv/public_html/18/bin/activate
```

---

### **"package.json not found"**

**Solution:** 
1. Check you're in the right folder: `pwd`
2. Should show: `/home/username/public_html`
3. If not, run: `cd /home/username/public_html`
4. Verify file exists: `ls -la package.json`

---

### **"EACCES: permission denied"**

**Solution:**
```bash
# Fix permissions
chmod -R 755 /home/username/public_html
```

---

### **"gyp ERR!" or "node-gyp" errors**

**Solution:** These are warnings, not errors. Installation continues.
- Wait for "added XXX packages" message
- If it completes, you're good!

---

### **Installation stuck or frozen**

**Solution:**
1. Press `Ctrl + C` to cancel
2. Clear npm cache: `npm cache clean --force`
3. Try again: `npm install`

---

## 📋 Quick Command Reference

```bash
# 1. Activate Node.js
source /home/username/nodevenv/public_html/18/bin/activate

# 2. Go to app folder
cd /home/username/public_html

# 3. Check package.json exists
ls -la package.json

# 4. Install packages
npm install

# 5. Build app
npm run build

# 6. Check if build folder exists
ls -la .next
```

---

## ✅ Success Indicators

**npm install successful:**
- ✅ See "added 500+ packages"
- ✅ No "ERR!" at the end
- ✅ `node_modules` folder created

**npm run build successful:**
- ✅ See "Compiled successfully"
- ✅ See "Generating static pages"
- ✅ `.next` folder created

---

## 🎯 Current Task

**Right now, do this:**

1. Open cPanel Terminal
2. Run activation command (from Node.js App page)
3. Run: `cd /home/YOUR_USERNAME/public_html`
4. Run: `npm install`
5. Wait for completion
6. Run: `npm run build`
7. Wait for completion
8. Start app in cPanel

**That's it!**
