fix(deploy): install frontend prod deps on server after deploy

adapter-node bundles the SvelteKit framework but leaves package.json
`dependencies` (clsx, bits-ui, etc.) external — they must be present in
node_modules on the server at runtime.

- deploy.sh: rsync package.json + pnpm-lock.yaml, run pnpm install --prod
- DEPLOYMENT.md: add pnpm to server setup with explanation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Piotr Oleszczyk 2026-03-01 13:56:28 +01:00
parent 3428885aaa
commit 91bc9e86d7
2 changed files with 19 additions and 4 deletions

View file

@ -21,8 +21,12 @@ deploy_frontend() {
echo "==> [frontend] Building locally..." echo "==> [frontend] Building locally..."
(cd frontend && pnpm run build) (cd frontend && pnpm run build)
echo "==> [frontend] Uploading build/..." echo "==> [frontend] Uploading build/ and package files..."
rsync -az --delete frontend/build/ "$SERVER:$REMOTE/frontend/build/" rsync -az --delete frontend/build/ "$SERVER:$REMOTE/frontend/build/"
rsync -az frontend/package.json frontend/pnpm-lock.yaml "$SERVER:$REMOTE/frontend/"
echo "==> [frontend] Installing production dependencies on server..."
ssh "$SERVER" "cd $REMOTE/frontend && pnpm install --prod --frozen-lockfile"
echo "==> [frontend] Restarting service..." echo "==> [frontend] Restarting service..."
ssh "$SERVER" "sudo systemctl restart innercontext-node && echo OK" ssh "$SERVER" "sudo systemctl restart innercontext-node && echo OK"

View file

@ -69,10 +69,12 @@ curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh
Installing to `/usr/local/bin` makes `uv` available system-wide (required for `sudo -u innercontext uv sync`). Installing to `/usr/local/bin` makes `uv` available system-wide (required for `sudo -u innercontext uv sync`).
### Node.js 24 LTS ### Node.js 24 LTS + pnpm
The server only needs Node.js to **run** the pre-built frontend bundle. The server needs Node.js to **run** the pre-built frontend bundle, and pnpm to
`pnpm` is **not** needed on the server — the frontend is always built locally. **install production runtime dependencies** (`clsx`, `bits-ui`, etc. —
`adapter-node` bundles the SvelteKit framework but leaves these external).
The frontend is never **built** on the server.
```bash ```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
@ -88,6 +90,15 @@ Use `--remove-destination` to replace any existing symlink with a real file:
cp --remove-destination "$(nvm which current)" /usr/local/bin/node cp --remove-destination "$(nvm which current)" /usr/local/bin/node
``` ```
Install pnpm as a standalone binary — self-contained, no wrapper scripts,
works system-wide:
```bash
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linux-x64" \
-o /usr/local/bin/pnpm
chmod 755 /usr/local/bin/pnpm
```
### Application user ### Application user
```bash ```bash