Skip to content

Improve missing npm install messaging#15732

Merged
IEvangelist merged 4 commits intomicrosoft:mainfrom
IEvangelist:dapine/better-npm-missing-messaging
Apr 6, 2026
Merged

Improve missing npm install messaging#15732
IEvangelist merged 4 commits intomicrosoft:mainfrom
IEvangelist:dapine/better-npm-missing-messaging

Conversation

@IEvangelist
Copy link
Copy Markdown
Member

@IEvangelist IEvangelist commented Mar 31, 2026

Description

Improve CLI messaging when guest-language project creation cannot run npm install because Node.js tools are missing.

Before this change, the CLI surfaced the raw missing npm/npx tool output or treated dependency installation as a failure even after project files had already been created. That made the TypeScript/guest-language scaffolding experience look broken or incomplete, even though the main issue was simply that Node.js was not available on PATH.

This change adds a small matcher for the existing missing-tool output and uses it to convert that condition into a warning in the flows where project creation has already succeeded. The warning explains that the files were created, automatic npm install could not run, and the user should install Node.js and run npm install manually.

Validation:

  • Added unit tests for the warning matcher
  • Ran focused CLI tests: CommandPathResolverTests and AutomaticNpmInstallWarningTests (10 passed)

Dependencies: None.

Fixes #15420

Example warning output

image

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 31, 2026 14:55
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15732

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15732"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Aspire CLI UX when guest-language scaffolding can’t run npm install due to missing Node.js tooling by detecting the known “missing npm/npx” output and downgrading that case to a warning (when project creation already succeeded).

Changes:

  • Added AutomaticNpmInstallWarning matcher + standardized warning message for missing npm/npx.
  • Updated guest-language scaffolding and SDK codegen flows to treat missing Node tools as a warning in “best-effort” dependency installation paths.
  • Added unit tests covering the matcher and the warning message text.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/Aspire.Cli.Tests/Utils/AutomaticNpmInstallWarningTests.cs Adds unit tests for missing-tool output matching and the warning message.
src/Aspire.Cli/Utils/AutomaticNpmInstallWarning.cs Introduces a small matcher + warning message constant for missing npm/npx.
src/Aspire.Cli/Scaffolding/ScaffoldingService.cs Converts missing Node tools during guest-language scaffolding dependency install into a warning and continues.
src/Aspire.Cli/Projects/GuestAppHostProject.cs Adds an option to treat missing Node tools as a warning in the “best effort” dependency install after SDK codegen.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist IEvangelist enabled auto-merge (squash) April 6, 2026 16:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

@IEvangelist IEvangelist merged commit 6caa210 into microsoft:main Apr 6, 2026
523 of 526 checks passed
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.

aspire new with no npm install should fail early

4 participants