nx: Migrating to 14.5.1 failing due to `@angular/cli`

Current Behavior

When migrating a project from nx 14.1.4 to 14.5.1, I’m getting the following error

 ERROR  Failed to run update-tsconfig-target from @angular/cli. This workspace is NOT up to date!

 >  NX   Path "/tsconfig.json" does not exist.

To workaround the issue I had to remove @angular/cli altogether from the repo. I’m assuming it might be ok as long as we only use the nx cli and stop using the ng cli, but it does seem a bit hacky. Although I can’t remember if Nx added the @angular/cli dependency itself in the first place or if we added it ourselves, so maybe it’s fine not having it around anymore.

Expected Behavior

Migration should complete without error.

Steps to Reproduce

I wish I knew for sure, I don’t have any custom stuff in the repo so I wanna believe any migration from 14.1.4 to 14.5.1, for a repo carrying at least one angular project (from 13.3 to 14.1), would prompt the error.

Failure Logs

This is the migration block causing the issue:

    {
      "version": "14.0.0",
      "factory": "./update-14/update-tsconfig-target",
      "description": "Update TypeScript compilation target to 'ES2020'.",
      "package": "@angular/cli",
      "name": "update-tsconfig-target"
    },

Environment

   Node : 16.15.0
   OS   : darwin arm64
   yarn : 1.22.18
   
   nx : 14.1.4
   @nrwl/angular : 14.1.4
   @nrwl/cypress : 14.1.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.4
   @nrwl/eslint-plugin-nx : 14.1.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.4
   @nrwl/js : 14.1.4
   @nrwl/linter : 14.1.4
   @nrwl/nest : 14.1.4
   @nrwl/next : Not Found
   @nrwl/node : 14.1.4
   @nrwl/nx-cloud : 14.0.3
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.1.4
   @nrwl/web : Not Found
   @nrwl/workspace : 14.1.4
   typescript : 4.6.3
   rxjs : 7.5.5
   ---------------------------------------
   Community plugins:
         @auth0/auth0-angular: 1.9.0
         ng2-charts: 3.0.9
         @sharethrough/nx-deploy: 2.3.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I have still this issue 😦 => run migration against nrwl/workspace 15 coming from 13

Same as @tobiashoeft


 >  NX   Failed to run update-tsconfig-target from @nrwl/angular. This workspace is NOT up to date!
 >  NX   Cannot find configuration for 'npm:@angular/animations' in /angular.json.

@leosvelperez is working on a fix for it. Stay tuned 👍

Workarounds

  1. Remove all migrations under @angular/cli from migrations.json and proceed.
  2. Wait until we release a version with a fix before migrating

Migrating an Angular workspace from Nx 14.5.8 to 15.8.1 was giving me this error on nx migrate --run-migrations:

 >  NX   Failed to run update-typescript-target from @nrwl/angular. This workspace is NOT up to date!

 >  NX   Cannot find module '@schematics/angular/utility/workspace-models'

Manually installing @angular/cli to latest (15.2.0) before running nx migrate --run-migrations resolved this. It was still left on 14.1.0 by the original nx migrate command.

Same for update-workspace-config which is not fixed yet!

Related to @muuvmuuv’s comment:

Running with Nx 15.2.3 leads to

 >  NX   Running migrations from 'migrations.json'
 >  NX   Failed to run update-workspace-config from @nrwl/angular. This workspace is NOT up to date!
 >  NX   Cannot convert undefined or null to object

TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at /dev/application/node_modules/@nrwl/angular/src/migrations/update-15-2-0/update-workspace-config.js:11:55
    at Generator.next (<anonymous>)
    at /dev/application/node_modules/@nrwl/angular/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/dev/application/node_modules/@nrwl/angular/node_modules/tslib/tslib.js:114:16)
    at updateWorkspaceConfigurations (/dev/application/node_modules/@nrwl/angular/src/migrations/update-15-2-0/update-workspace-config.js:7:20)
    at /private/var/folders/q1/vg364k2s16z3w9czd5jxw_w80000gn/T/tmp-19913-mwb1MSdpPXTY/node_modules/nx/src/command-line/migrate.js:763:15
    at Generator.next (<anonymous>)
    at /private/var/folders/q1/vg364k2s16z3w9czd5jxw_w80000gn/T/tmp-19913-mwb1MSdpPXTY/node_modules/tslib/tslib.js:118:75
Command failed: /var/folders/q1/vg364k2s16z3w9czd5jxw_w80000gn/T/tmp-19913-mwb1MSdpPXTY/node_modules/.bin/nx _migrate --run-migrations --verbose

Same here

Same for update-workspace-config which is not fixed yet!

CC: @ccosmincc (ref you here 'cause you fixed the other one)

https://github.com/nrwl/nx/blob/master/packages/angular/src/migrations/update-15-2-0/update-workspace-config.ts#L14