Getting 'Collection "@nrwl/angular" cannot be resolved' when running workspace-schematic
See original GitHub issueCurrent Behavior
When running npm run workspace-schematic -- {{ my-schematic-name }}
the following error is appearing:
Error: Collection "@nrwl/angular" cannot be resolved.
Expected Behavior
The schematic should run through successfully.
Steps to Reproduce
I created a simple GitHub repository so you can reproduce this:
git clone git@github.com:decline/nrwl-schematics-demo.git
cd nrwl-schematics-demo && npm install
npm run workspace-schematic -- test
Then in the interactive dialog just select “ui” for example and use “foobar” as the directory name
Failure Logs
Error: Collection "@nrwl/angular" cannot be resolved.
at NodeModulesEngineHost.resolve (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:74:19)
at NodeModulesEngineHost._resolveCollectionPath (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:79:37)
at NodeModulesEngineHost.createCollectionDescription (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:109:27)
at SchematicEngine._createCollectionDescription (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/src/engine/engine.js:147:40)
at SchematicEngine.createCollection (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/src/engine/engine.js:140:43)
at /Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/src/rules/schematic.js:23:43
at MergeMapSubscriber.project (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/@angular-devkit/schematics/src/rules/call.js:74:24)
at MergeMapSubscriber._tryNext (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
at MergeMapSubscriber._next (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
at MergeMapSubscriber.Subscriber.next (/Users/dom/Desktop/nrwl-schematics-demo/node_modules/rxjs/internal/Subscriber.js:66:18)
Environment
@nrwl/angular : 9.4.5 @nrwl/cli : 9.4.5 @nrwl/cypress : 9.4.5 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 9.4.5 @nrwl/linter : Not Found @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 9.4.5 @nrwl/web : Not Found @nrwl/workspace : 9.4.5 typescript : 3.8.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Nx generate get 'Collection "@nrwl/storybook" cannot be ...
The command is correct. Try run npm i @nrwl/storybook or yarn add @nrwl/storybook first and retry.
Read more >Nx Devkit and Angular Devkit
An Angular Schematic returns a rule that is then invoked with a tree. Nx Devkit generators do not use RxJS observables. Instead, you...
Read more >Generating code using schematics - Angular
It is a set of instructions for transforming a software project by generating or modifying code. Schematics are packaged into collections and installed...
Read more >nrwl/angular - npm
This package is an Angular plugin for Nx. Getting Started. Creating an Nx Workspace. Using npx. npx create-nx-workspace.
Read more >Nx/community - nrwl - Gitter
json Running migration migration-v11-navigation-extras-omissions Schematic "migration-v11-navigation-extras-omissions" not found in collection "@angular/core".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same issue, what helped me was running:
npm i @nrwl/angular
@filipgorny Good to know. It was indeed the “good solution”.