Skip to content

Fail fast when npm is missing during configure#14421

Open
cderv wants to merge 2 commits intomainfrom
fix/issue-14420
Open

Fail fast when npm is missing during configure#14421
cderv wants to merge 2 commits intomainfrom
fix/issue-14420

Conversation

@cderv
Copy link
Copy Markdown
Member

@cderv cderv commented Apr 23, 2026

On systems without npm, ./configure.sh downloads ~300MB of dependencies (Deno, Pandoc, Dart Sass, esbuild, Typst) before finally failing with a cryptic NotFound: Failed to spawn 'npm': entity not found from the buildQuartoPreviewJs() step.

Root Cause

configure() in package/src/common/configure.ts runs the dependency download loop before calling buildQuartoPreviewJs(), which is the only step in configure that requires npm. The npm executable is used to build src/resources/preview/quarto-preview.js — the webui that powers the quarto preview live-reload feature.

Fix

Check npm presence upfront using the existing which() helper from src/core/path.ts. If missing, throw a clear error before any downloads:

npm not found on PATH. Please install Node.js (which provides npm) before running configure.

This fails fast and avoids wasting download time on a build that cannot complete. A silent skip was considered but rejected — a Quarto build without quarto-preview.js would later fail at runtime when quarto preview tries to read the missing file, producing another confusing error.

Fixes #14420

@cderv cderv changed the title Warn and skip preview build when npm is missing during configure Fail fast when npm is missing during configure Apr 23, 2026
cderv added 2 commits April 23, 2026 19:59
Check for npm at the start of configure() instead of failing late in
buildQuartoPreviewJs() after ~300MB of downloads. When npm is missing,
emit a warning explaining that the quarto preview live-reload feature
will not be available, then skip the quarto-preview.js build step.
The rest of Quarto (render, pdf, publish) builds and runs normally.
A half-built Quarto without quarto-preview.js would later fail at
runtime when `quarto preview` tries to read the missing file, producing
another confusing error. Requiring npm upfront keeps the contract
simple: configure succeeds only if all required tools are available.
@cderv cderv force-pushed the fix/issue-14420 branch from 6c9150b to 9df4c7e Compare April 23, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quarto-cli (v1.10.3 and HEAD) fails to build on fresh installed systems (missing npm)

1 participant