nx icon indicating copy to clipboard operation
nx copied to clipboard

`@nrwl/workspace` package uses `@angular-devkit/schematics` as a dependency and doesn't list as a dependency in the `package.json`

Open lucasvieirasilva opened this issue 3 years ago • 0 comments

Current Behavior

@nrwl/workspace package uses @angular-devkit/schematics as a dependency and doesn't list as a dependency in the package.json.

@angular-devkit/schematics reference: https://github.com/nrwl/nx/blob/master/packages/workspace/src/utils/project-type.ts#L1

List of dependencies:

https://github.com/nrwl/nx/blob/master/packages/workspace/package.json#L68-L91

This issue causes this error NX Cannot find module '@angular-devkit/schematics' when the Nx workspace does not use any other package with the @angular-devkit/schematics as a dependency, like https://github.com/nrwl/nx/blob/master/packages/angular/package.json#L42.

Forcing to install the @angular-devkit/schematics as a dependency, or if you are building a new Nx generator listing a dependency of the custom generator, otherwise the generator won't work.

Expected Behavior

As the @angular-devkit/schematics package is used in the @nrwl/workspace package, add as a dependency of the package.

Steps to Reproduce

To reproduce this issue, the Nx workspace must be created with the apps preset which includes only the packages nx, @nrwl/cli and @nrwl/workspace, and use a custom Nx generator to create the projects (assuming this Nx generator doesn't install any other @nrwl package.

npx create-nx-workspace@latest <NxWorkspaceName> --preset apps

However, using any other Nx generator will install a package that has @angular-devkit/schematics as a dependency.

Failure Logs

image

Environment


 >  NX   Report complete - copy this into the issue template

   Node : 14.20.0
   OS   : darwin x64
   npm  : 6.14.17
   
   nx : 14.7.5
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.7.5
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.7.5
   @nrwl/js : Not Found
   @nrwl/linter : 14.7.5
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.7.5
   typescript : 4.7.4

lucasvieirasilva avatar Sep 20 '22 12:09 lucasvieirasilva