nrwl / nx

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

"npx nx list @nx/angular" => "@nx/angular is not currently installed" even after "npm install -D @nx/angular && npx nx g @nx/angular:init" #17079

Closed ICEDLEE337 closed 1 year ago

ICEDLEE337 commented 1 year ago

Current Behavior

First, thank you for nx. I've used it for years and I truly love it. I hope that you can help me resolve this issue using Angular in nx:

Running npx nx list @nx/angular produces error => @nx/angular is not currently installed. This occurs even after running npm install -D @nx/angular && npx nx g @nx/angular:init. Moreover, npx nx list confirms that @nx/angular is not installed EVEN THOUGH IT'S IN THE PACKAGE.JSON/NX.JSON.

Generally speaking, I can't run ng commands (like ng update).

Specifically, there is no way to update angular because using ng update fails with error => Error: This command is not available when running the Angular CLI outside a workspace.. And npx nx update produces a large message =>

Using Nx to run Angular CLI commands is deprecated and will be removed in a future version.
To run Angular CLI commands, use "ng".
Nx provides a much improved version of "ng update". It runs the same migrations, but allows you to:
- rerun the same migration multiple times
- reorder migrations, skip migrations
- fix migrations that "almost work"
- commit a partially migrated state
- change versions of packages to match organizational requirements
And, in general, it is lot more reliable for non-trivial workspaces. Read more at: https://nx.dev/getting-started/nx-and-angular#ng-update-and-nx-migrate
Run "nx migrate latest" to update to the latest version of Nx.
Running "ng update" can still be useful in some dev workflows, so we aren't planning to remove it.
If you need to use it, run "FORCE_NG_UPDATE=true ng update".

But sadly enough, following the instructions in that large block of text and running FORCE_NG_UPDATE=true ng update produces the same error => Error: This command is not available when running the Angular CLI outside a workspace..

Expected Behavior

ng update actually executes the update instead of producing the error => Error: This command is not available when running the Angular CLI outside a workspace.

GitHub Repo

https://github.com/nrwl/nx-examples

Steps to Reproduce

  1. use node v18.10.0 (npm v8.19.2)
  2. git clone https://github.com/nrwl/nx-examples
  3. cd nx-examples
  4. npm install
  5. npx ng update # errors
  6. npx nx update # prints a lot of text but does nothing
  7. npx nx list # shows that @nx/angular isn't installed

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.10.0
   OS     : darwin x64
   yarn   : 1.22.19
   Hasher : Native

   nx                 : 16.2.0-beta.0
   @nx/js             : 16.2.0-beta.0
   @nx/jest           : 16.2.0-beta.0
   @nx/linter         : 16.2.0-beta.0
   @nx/workspace      : 16.2.0-beta.0
   @nx/angular        : 16.2.0-beta.0
   @nx/cypress        : 16.2.0-beta.0
   @nx/devkit         : 16.2.0-beta.0
   @nx/eslint-plugin  : 16.2.0-beta.0
   @nx/react          : 16.2.0-beta.0
   @nrwl/tao          : 16.2.0-beta.0
   @nx/web            : 16.2.0-beta.0
   @nx/webpack        : 16.2.0-beta.0
   nx-cloud           : 16.0.5
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @ngrx/component-store : 16.0.0
   @ngrx/effects         : 16.0.0
   @ngrx/entity          : 16.0.0
   @ngrx/router-store    : 16.0.0
   @ngrx/store           : 16.0.0
   @ngrx/store-devtools  : 16.0.0

Failure Logs

`ng update` actually executes the update instead of producing the error => `Error: This command is not available when running the Angular CLI outside a workspace.`

Operating System

Additional Information

v18.10.0 (npm v8.19.2) nx@16 ng@16

ICEDLEE337 commented 1 year ago
npx nx list

 >  NX   Installed plugins:

   @angular-devkit/build-angular (executors)
   @nx/cypress (executors,generators)
   @nx/jest (executors,generators)
   @nx/js (executors,generators)
   @nx/linter (executors,generators)
   @nx/react (executors,generators)
   @nx/web (executors,generators)
   @nx/workspace (executors,generators)
   nx (executors)
   nx-cloud (generators)

 >  NX   Also available:

   @nx/angular (executors,generators)
   @nx/detox (executors,generators)
   @nx/esbuild (executors,generators)
   @nx/expo (executors,generators)
   @nx/express (generators)
   @nx/nest (generators)
   @nx/next (executors,generators)
   @nx/node (executors,generators)
   @nx/plugin (executors,generators)
   @nx/react-native (executors,generators)
   @nx/rollup (executors,generators)
   @nx/storybook (executors,generators)
   @nx/vite (executors,generators)
   @nx/webpack (executors,generators)

 >  NX   Community Plugins

   Looking for a technology / framework not listed above?
   There are many excellent plugins matintained by the Nx community.
   Search for the one you need here: https://nx.dev/plugins/registry.

 >  NX   Use "nx list [plugin]" to find out more
AgentEnder commented 1 year ago

nx list currently has some issues with ESM based plugins which is causing it to not find @nx/angular, but this has nothing to do with your issues updating.

You can use nx migrate in place of ng update to run migrations. FORCE_NG_UPDATE just forwards the command straight to Angular CLI, and they don't support Nx workspaces natively so without an angular.json file its going to throw.

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.