Overview
npx quartz build --serve builds a Quartz 4 vault to public/ and serves it with hot reload at http://localhost:8080. Quartz 4 needs Node 22 or newer and npm 10.9.2 or newer, declared in engines. For config patterns see quartz; for a Quartz 5 checkout (YAML config), follow upstream’s docs instead.
Steps
1. Get the code and the right Node
git clone -b v4 https://github.com/jackyzha0/quartz.git mysite # or your own repo
cd mysite
nvm install 22 && nvm use 22 # .nvmrc (nvm) or .node-version (fnm, mise) pins it per project
npm ciUse npm ci, not npm install; it installs exactly what package-lock.json records.
2. Serve with hot reload
npx quartz build --serveEdits under content/ rebuild automatically and the browser reloads over a WebSocket. Useful flags: --port (default 8080), --wsPort (default 3001), -d <dir> for the content folder, --verbose for per-file logging.
3. Run the production build before a PR
rm -rf public quartz/.quartz-cache
npx quartz buildThe dev server forgives some errors that a clean build reports. Exit code 0 means the build is shippable; see deploy-quartz-site.
Verify it worked
curl -sI http://localhost:8080/ | head -1 # HTTP/1.1 200 OK
ls public/index.htmlCommon errors
EADDRINUSEon 8080 or 3001. Another server holds the port; pass--port 8081or--wsPort 3002.- Build stalls at parsing. Run with
--verboseto find the file, then check for an unclosed code fence or malformed frontmatter. fatal: not a git repository, or every page shows the same date.CreatedModifiedDatereads git history; rungit init, or drop"git"from itsprioritylist.- Wikilinks render as plain text. The target page does not exist or its slug differs.
- Stale output after dependency changes. Delete
node_modulesandquartz/.quartz-cache, thennpm ci.
FAQ
What Node version does Quartz 4 need?
Quartz 4 needs Node 22 or newer and npm 10.9.2 or newer, declared in engines. Pin the version per project with .nvmrc or .node-version.
Should I use npm install or npm ci for Quartz?
Use npm ci, because it installs exactly what package-lock.json records.
What do I do when port 8080 is already in use?
EADDRINUSE means another server holds the port; pass --port 8081, or --wsPort 3002 when the WebSocket port 3001 is the one taken.
Why does every Quartz page show the same date?
CreatedModifiedDate reads git history, so a checkout without it falls back to one date. Run git init, or drop "git" from its priority list.
Is the dev server enough to check a Quartz site before a PR?
No; the dev server forgives some errors that a clean build reports. Delete public and quartz/.quartz-cache, run npx quartz build, and ship only on exit code 0.