nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.22k stars 2.31k forks source link

Cannot find module '@angular-devkit/schematics' #5429

Closed YogliB closed 1 year ago

YogliB commented 3 years ago

Current Behavior

I'm using pnpm with nx and having some trouble generating suing third party generators. I'm getting an error the some @angular/* dependencies are missing.

It seems that @nrwl/workspace depends on some angular packages that aren't listed in its package.json.

As far as I know, this could be an issue for pnpm because of how it works.

Expected Behavior

No error should happen, and the generator should run.

Steps to Reproduce

npm i -g pnpm@5
pnpx create-nx-workspace --package-manager=pnpm
pnpm add -D @nxext/sveltekit
pnpm nx g @nxext/sveltekit:app

Failure Logs

PS ~\oss\org> pnpm nx g @nxext/sveltekit:app   

> org@0.0.0 nx ~\oss\org
> nx "g" "@nxext/sveltekit:app"      

√ What name would you like to use? · app
Cannot find module '@angular-devkit/schematics'
Require stack:
- ~\oss\org\node_modules\.pnpm\@nrwl\workspace@12.0.8_prettier@2.2.1\node_modules\@nrwl\workspace\src\utils\ast-utils.js   
- ~\oss\org\node_modules\.pnpm\@nrwl\workspace@12.0.8_prettier@2.2.1\node_modules\@nrwl\workspace\src\utils\project-type.js
- ~\oss\org\node_modules\.pnpm\@nrwl\workspace@12.0.8_prettier@2.2.1\node_modules\@nrwl\workspace\index.js
- ~\oss\org\node_modules\.pnpm\@nxext\sveltekit@11.0.0-next.1\node_modules\@nxext\sveltekit\src\generators\application\generator.js 
- ~\oss\org\node_modules\.pnpm\@nrwl\tao@12.0.8\node_modules\@nrwl\tao\src\shared\workspace.js
- ~\oss\org\node_modules\.pnpm\@nrwl\tao@12.0.8\node_modules\@nrwl\tao\src\commands\generate.js
- ~\oss\org\node_modules\.pnpm\@nrwl\tao@12.0.8\node_modules\@nrwl\tao\index.js
- ~\oss\org\node_modules\.pnpm\@nrwl\cli@12.0.8\node_modules\@nrwl\cli\lib\init-local.js
- ~\oss\org\node_modules\.pnpm\@nrwl\cli@12.0.8\node_modules\@nrwl\cli\bin\nx.js
 ERROR  Command failed with exit code 1.

Environment

>  NX  Report complete - copy this into the issue template

  Node : 14.16.1
  OS   : win32 x64
  pnpm : 5.18.9

  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 12.0.8
  @nrwl/cypress : 12.0.8
  @nrwl/devkit : 12.0.8
  @nrwl/eslint-plugin-nx : 12.0.8
  @nrwl/express : Not Found
  @nrwl/jest : 12.0.8
  @nrwl/linter : 12.0.8
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.0.8
  @nrwl/web : Not Found
  @nrwl/workspace : 12.0.8
  @nrwl/storybook : Not Found
  @nrwl/gatsby : Not Found
  typescript : 4.1.5
Hotell commented 3 years ago

The issue is also present for non angular workspaces. We're using only devkit/workspace packages and once we import anything from workspace package it throws reported error.

What's the issue?

@nrwl/workspace still uses internally angular-devkit, (ast-utils file), and because it's not provided 8n package dependencies, consumers are forced to instal angular devkit manually.

Fix: We need to add angular-devkit to workspace package does

I can send PR if that's ok with you folks @FrozenPandaz @brandonroberts

Cheers

Hotell commented 3 years ago

created issue for better visibility https://github.com/nrwl/nx/issues/6153

danielrussellLA commented 2 years ago

I am experiencing this same issue

enchorb commented 2 years ago

Still get this issue on 13.10.2, have to manually add @angular-devkit/schematics to my devDependencies

merlosy commented 2 years ago

Hi, this is still happening in 13.10.5.

The @nrwl/workspace/src/utils/ast-utils.js seems to be the cause of the issue.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.