Nx: Migration from 10.4.4 to 11.0.8 fails

Created on 16 Dec 2020  路  4Comments  路  Source: nrwl/nx

Current Behavior

I cannot migrate from 10.4.4 to 11.0.8
We have renovate bot in place which fails to run the migrations
The error message is

Schematic "update-script-to-invoke-nx-migrate" not found in collection "@nrwl/workspace".
Command failed: npx tao migrate --run-migrations=migrations.json

Expected Behavior

I can migrate from 10.4.7 to 11.0.8

Steps to Reproduce

npx [email protected] workspace --preset angular --appName my-app --style scss --linter tslint --interactive false --nx-cloud false
npx nx migrate @nrwl/workspace
[ -f migrations.json ] && npx nx migrate --run-migrations=migrations.json
{
  "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": "11.0.0",
      "description": "Check that the right update command is used",
      "factory": "./src/migrations/update-11-0-0/update-command-check",
      "package": "@nrwl/workspace",
      "name": "update-command-check"
    },
    {
      "version": "11.0.2",
      "description": "Rename the workspace-schematic script into workspace-generator script",
      "factory": "./src/migrations/update-11-0-0/rename-workspace-schematic-script",
      "package": "@nrwl/workspace",
      "name": "rename-workspace-schematic-script"
    },
    {
      "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"
    }
  ]
}



md5-052594a7aedea3f00cf4072206869f17



 NX  Report complete - copy this into the issue template

  nx : Not Found
  @nrwl/angular : 10.4.4
  @nrwl/cli : 10.4.4
  @nrwl/cypress : 10.4.4
  @nrwl/eslint-plugin-nx : 10.4.4
  @nrwl/express : Not Found
  @nrwl/jest : 10.4.4
  @nrwl/linter : 10.4.4
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 10.4.4
  @nrwl/web : Not Found
  @nrwl/workspace : 10.4.4
  typescript : 4.0.5
retry with latest misc bug

All 4 comments

Hi, it looks like you are missing the latest versions.

You would need to install before running the migrations in the migrations.json

Have the same Problem.

From:

 "@nrwl/cli": "10.4.4",
    "@nrwl/cypress": "10.4.4",
    "@nrwl/jest": "10.4.4",
    "@nrwl/tao": "10.4.4",
    "@nrwl/workspace": "10.4.4",

Successfully finished update-node-types
---------------------------------------------------------
Running migration rename-workspace-schematics
ENOENT: noyargs.js_1132                throw err such file or directory, link 'tools\schematics' -> '
Error: Command failed: npx tao migrate --run-migrations=migrations.json


  Node : 14.5.0
  OS   : win32 x64
  npm  : 6.14.8

  nx : Not Found
  @nrwl/angular : 11.0.10
  @nrwl/cli : 11.0.10
  @nrwl/cypress : 11.0.10
  @nrwl/devkit : 11.0.10
  @nrwl/eslint-plugin-nx : Not Found
  @nrwl/express : Not Found
  @nrwl/jest : 11.0.10
  @nrwl/linter : 11.0.10
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.0.10
  @nrwl/web : Not Found
  @nrwl/workspace : 11.0.10
  typescript : 4.0.5

Btw: i installed the latest version of nx cli and workspace.

migration.config:

{
  "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": "11.0.0",
      "description": "Check that the right update command is used",
      "factory": "./src/migrations/update-11-0-0/update-command-check",
      "package": "@nrwl/workspace",
      "name": "update-command-check"
    },
    {
      "version": "11.0.2",
      "description": "Rename the workspace-schematic script into workspace-generator script",
      "factory": "./src/migrations/update-11-0-0/rename-workspace-schematic-script",
      "package": "@nrwl/workspace",
      "name": "rename-workspace-schematic-script"
    },
    {
      "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"
    }
  ]
}

@mehrad-rafigh I think you're missing a step. After running nx migrate, you're getting this output:

- Make sure package.json changes make sense and then run 'npm install' or 'yarn'
- Run 'nx migrate --run-migrations=migrations.json'

Your "Steps to Reproduct" seem to be missing the npm install step.

npx [email protected] workspace --preset angular --appName my-app --style scss --linter tslint --interactive false --nx-cloud false
npx nx migrate @nrwl/workspace
# 馃憠馃徎 npm install
[ -f migrations.json ] && npx nx migrate --run-migrations=migrations.json

I ran into the same issue and running npm install before nx migrate --run-migrations=migrations.json did the trick.

Sry guys. @FrozenPandaz and @luchsamapparat are right. I was missing an npm install
Thank you all

Was this page helpful?
0 / 5 - 0 ratings