Help
Troubleshooting
Section titled “Troubleshooting”A project is not found
Section titled “A project is not found”Nx does not list an Astro project, or it has no targets.
- Check that
nx.jsonlists@geekvetica/nx-astroinplugins. If not, runnx g @geekvetica/nx-astro:init. - Check that the directory has an
astro.config.mjs,.jsor.ts. - Run
nx reset, thennx show projects.
An alias cannot be resolved
Section titled “An alias cannot be resolved”The paths in an app’s tsconfig.json replace those of the workspace. Aliases of libraries that are newer than the app have to be added by hand.
check reports error 6307 for a shared component
Section titled “check reports error 6307 for a shared component”The workspace config sets composite. Add the library to include of the app’s tsconfig.json, as shown in Share code between apps.
A module such as astro:content has no types
Section titled “A module such as astro:content has no types”Generate them:
nx run my-app:syncIf the target reports a cache hit, remove "cache": true from it in project.json.
The build never comes from the cache
Section titled “The build never comes from the cache”The first build changes package.json of the app, so the second one runs as well. Commit that change.
The build comes from the cache, but the output is missing
Section titled “The build comes from the cache, but the output is missing”The site is built outside the cached output path, so Nx has nothing to restore. Point outDir there.
test fails because there are no test files
Section titled “test fails because there are no test files”With vitest in the root package.json, every Astro project gets a test target. Let projects without tests pass:
{ "targetDefaults": { "@geekvetica/nx-astro:test": { "options": { "additionalArgs": ["--passWithNoTests"] } } }}Tsconfig not found
Section titled “Tsconfig not found”The root tsconfig.json references a directory without a tsconfig.json. Create the file in that project, or remove the reference.
pnpm stops with ERR_PNPM_IGNORED_BUILDS
Section titled “pnpm stops with ERR_PNPM_IGNORED_BUILDS”pnpm wants to know which packages may run install scripts. Choose them with pnpm approve-builds and run the command again.
Questions
Section titled “Questions”Can I use React, Vue or another framework?
Section titled “Can I use React, Vue or another framework?”Yes. Install the Astro integration in the workspace root and add it to the Astro config of the app. The build copies @astrojs/* versions to the app.
Does it support server rendering?
Section titled “Does it support server rendering?”Yes, see Server rendering with Node. Adapters belong in the Astro config.
Which targets are cached?
Section titled “Which targets are cached?”build, check and test. CI and caching lists their inputs.
Do I need project.json?
Section titled “Do I need project.json?”No. An Astro config is enough for the inferred targets.
Get more help
Section titled “Get more help”Report a bug or ask for a feature in the issues on GitHub. Include the versions of the plugin, Nx and Astro, and the output of the command with --verbose.
nx-astro is developed and maintained by Geekvetica.