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.

New Workspace + add Angular = Could not find module "@nrwl/workspace"

See original GitHub issue

Expected Behavior

Creating new workspace via npm, add Angular tooling, and generate Angular app should use latest version and not crash.

This relates to ticket #1497, but is not the same

Current Behavior

Crashes at end of ng add @nrwl/angular

Failure Information

…error received during ng add @nrwl/angular install:

Installed packages for tooling via npm.
Could not find module "@nrwl/workspace" from "...\myworkspace".
Error: Could not find module "@nrwl/workspace" from "...\myworkspace".
    at Object.resolve (...\myworkspace\node_modules\@angular-devkit\core\node\resolve.js:141:11)
    at NodeModulesEngineHost._resolvePackageJson (...\myworkspace\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:28:21)
    at NodeModulesEngineHost._resolveCollectionPath (...\myworkspace\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:69:40)
    at NodeModulesEngineHost.createCollectionDescription (...\myworkspace\node_modules\@angular-devkit\schematics\tools\file-system-engine-host-base.js:111:27)
    at SchematicEngine._createCollectionDescription (...\myworkspace\node_modules\@angular-devkit\schematics\src\engine\engine.js:147:40)
    at SchematicEngine._createCollectionDescription (...\myworkspace\node_modules\@angular-devkit\schematics\src\engine\engine.js:158:48)
    at SchematicEngine.createCollection (...\myworkspace\node_modules\@angular-devkit\schematics\src\engine\engine.js:140:43)
    at AddCommand.getCollection (...\myworkspace\node_modules\@angular\cli\models\schematic-command.js:123:35)
    at AddCommand.runSchematic (...\myworkspace\node_modules\@angular\cli\models\schematic-command.js:262:50)
    at AddCommand.executeSchematic (...\myworkspace\node_modules\@angular\cli\commands\add-impl.js:134:31)
    at AddCommand.run (...\myworkspace\node_modules\@angular\cli\commands\add-impl.js:105:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Steps to Reproduce

  1. npm init nx-workspace myworkspace
  2. From new workspace folder… ng add @nrwl/angular

Context

relevant information about my setup:

  • version of Nx used: latest provided by npm init nx-workspace myworkspace - 7.6.2
  • version of Angular CLI used: defined by nx in workspace - 7.3.1, but my global is 8.0.3
  • Node: 10.14.0
  • OS: win32 x64
  • I’ve created a demo repo for you to see what was created by running the above commands on my Windows laptop.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:27 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
tdekoekkoekcommented, Jul 24, 2019

This keeps haunting me. I’ve created a brand new workspace with the latest nx as far as I know and I keep getting this error. Is there any fix?

6reactions
svox1commented, Jan 24, 2020

I have still this error. Installed nx for the first time with:

npm install -g @nrwl/cli

source: https://nx.dev/web/guides/cli

After that I try whats @vsavkin write: https://github.com/nrwl/nx/issues/1306#issuecomment-495283429

npx create-nx-workspace@latest my-ui-admin --preset=empty
ng g app angularapp --e2e-test-runner=proctractor

Because I want a app with protractor.

After last command I get the error:

An unhandled exception occurred: Schematic "app" not found in collection "@nrwl/workspace".

I tried it also with:

npm init nx-workspace myworkspace

-> empty workspace -> angular-cli

and after that the ng g add command, but with same result.

My System infos:

Mac: 10.15.2
Nx Version: 8.11.2
Angular CLI: 8.3.14
Node: 10.18.0
OS: darwin x64

rough start 😉

Update: After reading: https://github.com/nrwl/nx I get it work:

npm install --save-dev @nrwl/angular
nx g @nrwl/angular:app myapp --e2e-test-runner=proctractor
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why am i getting error on using any `nx` commands
Just had this issue myself. Fixed it by deleting all my node_modules, verifying npm cache, updating my global @nrwl-cli, and reinstalling.
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 >
nrwl-nx/community - Gitter
I'm doing an "npm ci" on my code and I'm getting this error: Error: Cannot find module '@nrwl/workspace/src/command-line/supported-nx-commands' Require ...
Read more >
Setup a Monorepo with PNPM workspaces and speed it up ...
Let's install these dependencies from the root of the workspace: ... Error: Cannot find module '/Users/juri/nrwl/content/pnpm-demos/pnpm-mono/apps/my-remix- ...
Read more >
Hi, did you manage to get your unit tests running with nx 14 ...
If I simply create-nx-workspace, change the package.json to use angular 14 versions, jest 28, ... Cannot find module '@angular/core/testing' from '../.
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