question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting 'Collection "@nrwl/angular" cannot be resolved' when running workspace-schematic

See original GitHub issue

Current 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:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
filipgornycommented, Aug 3, 2021

I had the same issue, what helped me was running:

npm i @nrwl/angular

0reactions
VaultDevelopercommented, Sep 12, 2021

@filipgorny Good to know. It was indeed the “good solution”.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found