From 91bc9e86d79a6bf22c34c7a373b15a51cc594fe5 Mon Sep 17 00:00:00 2001 From: Piotr Oleszczyk Date: Sun, 1 Mar 2026 13:56:28 +0100 Subject: [PATCH] fix(deploy): install frontend prod deps on server after deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- deploy.sh | 6 +++++- docs/DEPLOYMENT.md | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index c1378a6..2e6e668 100755 --- a/deploy.sh +++ b/deploy.sh @@ -21,8 +21,12 @@ deploy_frontend() { echo "==> [frontend] Building locally..." (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 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..." ssh "$SERVER" "sudo systemctl restart innercontext-node && echo OK" diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index f33d219..1eb7005 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -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`). -### Node.js 24 LTS +### Node.js 24 LTS + pnpm -The server only needs Node.js to **run** the pre-built frontend bundle. -`pnpm` is **not** needed on the server — the frontend is always built locally. +The server needs Node.js to **run** the pre-built frontend bundle, and pnpm to +**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 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 ``` +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 ```bash