Running the Neurodesk Site Locally (Astro + Starlight)
The Neurodesk website is built with Astro using the Starlight documentation theme. This page covers how to run it locally so you can preview your changes before opening a pull request.
1. Prerequisites
Section titled “1. Prerequisites”Install Node.js first: pnpm is a Node program and will fail with env: node: No such file or directory if no runtime is present.
Installing Node.js
Section titled “Installing Node.js”Check what you already have:
node --versionIf that prints v20 or higher, skip to Installing pnpm. If it prints
command not found, install Node using whichever option suits your system:
With Homebrew:
brew install nodeWithout Homebrew, download the macOS LTS installer from nodejs.org and run it.
Your distribution’s package may be older than Node 20. Check first:
# Debian / Ubuntusudo apt install nodejs npm
# Fedorasudo dnf install nodejsIf the packaged version is too old, use nvm, which installs Node into your home directory and lets you switch versions per project:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash# then open a new terminalnvm install 20nvm use 20With winget:
winget install OpenJS.NodeJS.LTSOtherwise download the Windows LTS installer from nodejs.org.
Installing pnpm
Section titled “Installing pnpm”Try Corepack first — it ships with some Node builds and pins pnpm per project:
corepack enablecorepack prepare pnpm@latest --activateIf that reports command not found, Corepack is not bundled with your Node build. Use one of these
instead — pick a single method, not several:
With Homebrew:
brew install pnpmOr the standalone installer:
curl -fsSL https://get.pnpm.io/install.sh | sh -The standalone installer:
curl -fsSL https://get.pnpm.io/install.sh | sh -Or, if you already have npm:
npm install -g pnpmIn PowerShell:
Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-ExpressionOr with winget:
winget install pnpm.pnpmVerify both before continuing:
node --versionpnpm --versionOnly move on once both print a version number. Run the remaining commands one at a time — if you paste them as a block, later commands run before the earlier ones have finished.
2. Install dependencies
Section titled “2. Install dependencies”From the root of your cloned repository:
pnpm installThis reads pnpm-lock.yaml and installs the exact dependency versions the site is built with. You
only need to repeat this when dependencies change (for example after pulling in a branch that
updates package.json).
3. Start the dev server
Section titled “3. Start the dev server”pnpm devYour local site will be available at http://localhost:4321.
The dev server watches your files and hot-reloads the browser as you save, so you can keep it
running while you edit. Press Ctrl+C in the terminal to stop it (this is Ctrl+C on macOS too,
not Cmd+C).
4. Build and preview the production site
Section titled “4. Build and preview the production site”Before opening a pull request, it is worth confirming that the site builds cleanly. The dev server is more forgiving than the production build, so this step catches broken links and invalid frontmatter that you would otherwise only see in CI.
-
Build the static site into
dist/:Terminal window pnpm build -
Serve that build locally:
Terminal window pnpm preview -
Open the URL printed in your terminal and check your pages.
If the build fails, the error message names the file and line to fix. Common causes are a broken
internal link, a missing image in public/, or an MDX component that was used without being
imported. See the Markdown Reference for correct
syntax.
5. Where things live
Section titled “5. Where things live”| Path | Contents |
|---|---|
src/content/docs/ | All documentation pages (.md and .mdx). The file path becomes the URL. |
src/components/ | Reusable Astro and React components used inside pages. |
src/styles/ | Custom CSS layered on top of the Starlight theme. |
public/ | Static assets served as-is: images, icons, downloads. |
astro.config.mjs | Site config, sidebar structure, and redirects. |
6. Adding a page to the sidebar
Section titled “6. Adding a page to the sidebar”Most sections of the sidebar are generated automatically from the directory structure in
astro.config.mjs, so a new file in an existing folder appears without any extra configuration.
Control its position and label from the page’s own frontmatter:
---title: My New Pagedescription: A short summary used for search results and social previews.sidebar: label: Short Label order: 2---If you add a whole new top-level section, add it to the sidebar array in astro.config.mjs.
7. Changing a page’s URL
Section titled “7. Changing a page’s URL”The URL of a page follows its path under src/content/docs/. If you rename or move a file, add an
entry to the redirects map in astro.config.mjs so existing links keep working:
redirects: { '/old/path': '/new/path/',}Troubleshooting
Section titled “Troubleshooting”env: node: No such file or directory (or 'node' is not recognized on Windows) — pnpm is
installed but Node.js is not. pnpm cannot run without a Node runtime; see
Installing Node.js above.
pnpm: command not found — pnpm is not installed, or it is installed but not yet on your
PATH. Work through Installing pnpm, then open a new terminal so the updated
PATH takes effect.
corepack: command not found — Corepack is not bundled with your Node build. This is expected
on Homebrew and some distro builds; use one of the other pnpm install methods instead.
Install fails with an engine or version error — check node --version. Node 20 or newer is
required; older releases will fail on some dependencies.
Changes do not appear in the browser — stop the dev server, delete the Astro cache, and start again:
rm -rf node_modules/.astropnpm devrm -rf node_modules/.astropnpm devRemove-Item -Recurse -Force node_modules\.astropnpm devA stale or corrupted install — remove and reinstall dependencies:
rm -rf node_modulespnpm installrm -rf node_modulespnpm installRemove-Item -Recurse -Force node_modulespnpm installpnpm install fails with a permissions error — you may be running it outside the repository, or
in a directory you do not own. Confirm you are in the repository root (the folder containing
package.json) and that you own it. Do not run pnpm install with sudo.
Need help?
Section titled “Need help?”If you get stuck, open a discussion or an issue and we will help you out.