I have a nx workspace with nx CLI. The workspace has angular projects and when I'm migrating it to the latest nx 11, it bumps the dependencies but the migration scripts fail and fail to update the angular 11 specific migrations.
Migration script that is generated:
{
"migrations": [
{
"version": "10.4.5",
"description": "Update the 'update' npm script to invoke nx migrate",
"factory": "./src/migrations/update-10-4-0/update-script-to-invoke-nx-migrate",
"package": "@nrwl/workspace",
"name": "update-script-to-invoke-nx-migrate"
},
{
"version": "11.0.0-beta.3",
"description": "Update the decoration script when using Angular CLI",
"factory": "./src/migrations/update-11-0-0/update-decorate-angular-cli",
"package": "@nrwl/workspace",
"name": "update-decorate-angular-cli"
},
{
"version": "11.0.0-beta.3",
"description": "Update the @types/node package",
"factory": "./src/migrations/update-11-0-0/update-node-types",
"package": "@nrwl/workspace",
"name": "update-node-types"
},
{
"version": "11.0.0-beta.3",
"description": "Rename tools/schematics into tools/generators",
"factory": "./src/migrations/update-11-0-0/rename-workspace-schematics",
"package": "@nrwl/workspace",
"name": "rename-workspace-schematics"
},
{
"version": "11.0.0-beta.15",
"description": "Adds `outputs` based on builders",
"factory": "./src/migrations/update-11-0-0/add-outputs-in-workspace",
"package": "@nrwl/workspace",
"name": "add-outputs-in-workspace"
},
{
"version": "10.5.0-beta.0",
"description": "Update eslint config and builder to extend from new Nx Angular presets and lint templates",
"factory": "./src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint",
"package": "@nrwl/angular",
"name": "add-template-support-and-presets-to-eslint"
},
{
"version": "11.0.0-beta.13",
"description": "Update builder configurations and dependencies",
"factory": "./src/migrations/update-11-0-0/update-builders-config",
"package": "@nrwl/angular",
"name": "update-11-0-0"
},
{
"version": "11.0.0-beta",
"description": "NavigationExtras omissions migration. In version 11, some unsupported properties were omitted from the `extras` parameter of the `Router.navigateByUrl` and `Router.createUrlTree` methods.",
"factory": "./migrations/navigation-extras-omissions/index",
"package": "@angular/core",
"name": "migration-v11-navigation-extras-omissions"
},
{
"version": "11.0.0-beta",
"description": "The default value for `relativeLinkResolution` is changing from 'legacy' to 'corrected'.\nThis migration updates `RouterModule` configurations that use the default value to \nnow specifically use 'legacy' to prevent breakages when updating.",
"factory": "./migrations/relative-link-resolution/index",
"package": "@angular/core",
"name": "migration-v11-router-relative-link-resolution-default"
},
{
"version": "11.0.0-beta",
"description": "In Angular version 11, the type of `AbstractControl.parent` can be `null` to reflect the runtime value more accurately. This migration automatically adds non-null assertions to existing accesses of the `parent` property on types like `FormControl`, `FormArray` and `FormGroup`.",
"factory": "./migrations/abstract-control-parent/index",
"package": "@angular/core",
"name": "migration-v11-abstract-control-parent"
},
{
"version": "11.0.0-beta",
"description": "ViewEncapsulation.Native has been removed as of Angular version 11. This migration replaces any usages with ViewEncapsulation.ShadowDom.",
"factory": "./migrations/native-view-encapsulation/index",
"package": "@angular/core",
"name": "migration-v11-native-view-encapsulation"
},
{
"version": "11.0.0-beta",
"description": "`async` to `waitForAsync` migration. The `async` testing function has been renamed to `waitForAsync` to avoid confusion with the native `async` keyword.",
"factory": "./migrations/wait-for-async/index",
"package": "@angular/core",
"name": "migration-v11-wait-for-async"
},
{
"version": "11.0.0-beta",
"description": "NavigationExtras.preserveQueryParams has been removed as of Angular version 11. This migration replaces any usages with the appropriate assignment of the queryParamsHandling key.",
"factory": "./migrations/router-preserve-query-params/index",
"package": "@angular/core",
"name": "migration-v11-router-preserve-query-params"
},
{
"version": "11.0.0-beta",
"description": "Updates the `initialNavigation` property for `RouterModule.forRoot`.",
"factory": "./migrations/initial-navigation/index",
"package": "@angular/core",
"name": "migration-v11-router-initial-navigation-options"
}
]
}
It fails to run all the angular specific migrations.
Should have successfully run all the update scripts in the migration.json
"@nrwl/workspace": "10.4.4"yarn add -D @nrwl/[email protected].yarn nx generate @nrwl/angular:application --name=migration-app --style=scss --directory=client --linter=eslint --routing --strict --tags='scope: migration, type: app'yarn nx generate @nrwl/angular:library --name=core --style=scss --linter=eslint --tags='scope: core, type: utils' and import them into the angular application.yarn run update.yarn nx migrate --run-migrations=migrations.jsonCould not find any tsconfig file. Cannot migrate away from Native view encapsulation.The update scripts that fail
{
"version": "11.0.0-beta",
"description": "NavigationExtras.preserveQueryParams has been removed as of Angular version 11. This migration replaces any usages with the appropriate assignment of the queryParamsHandling key.",
"factory": "./migrations/router-preserve-query-params/index",
"package": "@angular/core",
"name": "migration-v11-router-preserve-query-params"
},
{
"version": "11.0.0-beta",
"description": "Updates the `initialNavigation` property for `RouterModule.forRoot`.",
"factory": "./migrations/initial-navigation/index",
"package": "@angular/core",
"name": "migration-v11-router-initial-navigation-options"
}
{
"version": "11.0.0-beta",
"description": "NavigationExtras omissions migration. In version 11, some unsupported properties were omitted from the `extras` parameter of the `Router.navigateByUrl` and `Router.createUrlTree` methods.",
"factory": "./migrations/navigation-extras-omissions/index",
"package": "@angular/core",
"name": "migration-v11-navigation-extras-omissions"
},
{
"version": "11.0.0-beta",
"description": "The default value for `relativeLinkResolution` is changing from 'legacy' to 'corrected'.\nThis migration updates `RouterModule` configurations that use the default value to \nnow specifically use 'legacy' to prevent breakages when updating.",
"factory": "./migrations/relative-link-resolution/index",
"package": "@angular/core",
"name": "migration-v11-router-relative-link-resolution-default"
},
{
"version": "11.0.0-beta",
"description": "In Angular version 11, the type of `AbstractControl.parent` can be `null` to reflect the runtime value more accurately. This migration automatically adds non-null assertions to existing accesses of the `parent` property on types like `FormControl`, `FormArray` and `FormGroup`.",
"factory": "./migrations/abstract-control-parent/index",
"package": "@angular/core",
"name": "migration-v11-abstract-control-parent"
},
{
"version": "11.0.0-beta",
"description": "ViewEncapsulation.Native has been removed as of Angular version 11. This migration replaces any usages with ViewEncapsulation.ShadowDom.",
"factory": "./migrations/native-view-encapsulation/index",
"package": "@angular/core",
"name": "migration-v11-native-view-encapsulation"
},
{
"version": "11.0.0-beta",
"description": "`async` to `waitForAsync` migration. The `async` testing function has been renamed to `waitForAsync` to avoid confusion with the native `async` keyword.",
"factory": "./migrations/wait-for-async/index",
"package": "@angular/core",
"name": "migration-v11-wait-for-async"
}
Minimal Github Repo for the issue
https://github.com/navneetsharmaui/nx-migration-issue


Node : 12.14.1
OS : linux x64
yarn : 1.22.5
nx : Not Found
@nrwl/angular : 11.0.1
@nrwl/cli : 11.0.1
@nrwl/cypress : 11.0.1
@nrwl/devkit : 11.0.1
@nrwl/eslint-plugin-nx : 11.0.1
@nrwl/express : 11.0.1
@nrwl/jest : 11.0.1
@nrwl/linter : 11.0.1
@nrwl/nest : 11.0.1
@nrwl/next : Not Found
@nrwl/node : 11.0.1
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 11.0.1
@nrwl/web : 11.0.1
@nrwl/workspace : 11.0.1
typescript : 4.0.5
I have the same problem when trying to migrate from from angular 10.1.0 to angular 11.0.4 and @nrwl/* 10.3.1 to 11.0.2
I was running nx 10.3.1 globally. I first updated nx from 10.3.1. to 11.0.2.
I then run the migration commands
nx migrate @nrwl/workspace@latest
npm install
nx migrate --run-migrations=migrations.json
and received the same error message as reported above.
This workspace started as an nx 10.3.0, so my problem can not be narrow down to workspaces <=9.
The issue is that the migration provided by the Angular framework looks at angular.json trying to resolve the tsconfig. In your case there is no angular.json. We normally work around this issue by telling the Angular CLI to also look at workspace.json. This wasn't an option here.
We have a generic solution for this prepared and we are planning to land it by end of week. For now, the workaround is:
mv workspace.json angular.jsonnx migrate --run-migrations=migrations.jsonmv angular.json workspace.jsonI know it's annoying.
Does it make sense?
Thank you Victor. Yes I get it. That worked as far as getting the migration run. Now run into other migration issues (ngrx code not compiling among others) but different problem.
Thank you very much.
The issue is that the migration provided by the Angular framework looks at
angular.jsontrying to resolve the tsconfig. In your case there is no angular.json. We normally work around this issue by telling the Angular CLI to also look at workspace.json. This wasn't an option here.We have a generic solution for this prepared and we are planning to land it by end of week. For now, the workaround is:
mv workspace.json angular.jsonnx migrate --run-migrations=migrations.jsonmv angular.json workspace.jsonI know it's annoying.
Does it make sense?
Yes Make sense
Fixed the issue here: https://github.com/nrwl/nx/commit/4278cfd337bbee155ed5efba83c4edc3df58dd30 I'll cut a patch release tonight.
I'm going to close this. If you have any issues upgrading after the release, let me know.
Most helpful comment
The issue is that the migration provided by the Angular framework looks at
angular.jsontrying to resolve the tsconfig. In your case there is no angular.json. We normally work around this issue by telling the Angular CLI to also look at workspace.json. This wasn't an option here.We have a generic solution for this prepared and we are planning to land it by end of week. For now, the workaround is:
mv workspace.json angular.jsonnx migrate --run-migrations=migrations.jsonmv angular.json workspace.jsonI know it's annoying.
Does it make sense?