New Workspace + add Angular = Could not find module "@nrwl/workspace"
See original GitHub issueExpected 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
npm init nx-workspace myworkspace
- 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:
- Created 4 years ago
- Reactions:11
- Comments:27 (1 by maintainers)
Top 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 >
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
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?
I have still this error. Installed nx for the first time with:
source: https://nx.dev/web/guides/cli
After that I try whats @vsavkin write: https://github.com/nrwl/nx/issues/1306#issuecomment-495283429
Because I want a app with protractor.
After last command I get the error:
I tried it also with:
-> empty workspace -> angular-cli
and after that the ng g add command, but with same result.
My System infos:
rough start 😉
Update: After reading: https://github.com/nrwl/nx I get it work: