Skip to content

fix(schematics): resolve built-in collection by path#3473

Open
yudin-s wants to merge 1 commit into
nestjs:masterfrom
yudin-s:fix/pnpm-global-schematics-resolution
Open

fix(schematics): resolve built-in collection by path#3473
yudin-s wants to merge 1 commit into
nestjs:masterfrom
yudin-s:fix/pnpm-global-schematics-resolution

Conversation

@yudin-s

@yudin-s yudin-s commented Jul 1, 2026

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

When @nestjs/cli is installed globally with pnpm 11, nest new can fail before scaffolding because the spawned Angular schematics CLI cannot resolve the built-in @nestjs/schematics collection from pnpm's global store layout.

Issue Number: Fixes #3471

What is the new behavior?

NestCollection resolves the installed @nestjs/schematics package metadata and invokes schematics through the package's concrete collection file path. The collection path is quoted so installs under paths containing spaces still work.

Because schematics-cli treats collection file paths as local collections, the CLI also passes --no-debug to avoid enabling debug/dry-run defaults for normal nest new and nest generate commands.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Local validation:

npm test -- --runTestsByPath test/lib/schematics/nest.collection.spec.ts
npm run build
npm exec -- prettier --check lib/schematics/nest.collection.ts test/lib/schematics/nest.collection.spec.ts
git diff --check
npm pack --pack-destination /tmp/nest-3471-pr-pack
# Install the packed CLI with pnpm 11 in an isolated global home, then:
nest new pr-example --skip-install --skip-git -p pnpm

@yudin-s
yudin-s force-pushed the fix/pnpm-global-schematics-resolution branch from 68b278c to c44a0c0 Compare July 1, 2026 09:00
@yudin-s
yudin-s marked this pull request as ready for review July 7, 2026 09:52
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.

Error: Collection "@nestjs/schematics" cannot be resolved.

1 participant