nx: Unable to update NX to latest version - No such file or directory error

Expected Behavior

Updating Nx following https://nx.dev/angular/guides/update guide goes without errors.

Current Behavior

My current workspace version is 8.7.1. I’ve attempted to update it to the latest following the guide on https://nx.dev/angular/guides/update, but got the following error:

$ npx nx migrate @nrwl/workspace
Fetching meta data about packages.
It may take a few minutes.
Fetching @nrwl/workspace@latest
Fetching @ngrx/store@8.5.0
Fetching @ngrx/effects@8.5.0
Fetching @ngrx/entity@8.5.0
Fetching @ngrx/router-store@8.5.0
Fetching @ngrx/schematics@8.5.0
Fetching @ngrx/store-devtools@8.5.0
Fetching @angular-devkit/architect@0.803.14
Fetching @angular-devkit/build-angular@0.803.14
Fetching @angular-devkit/build-ng-packagr@0.803.14
Fetching @angular-devkit/build-webpack@0.803.14
Fetching @angular-devkit/core@8.3.14
Fetching @angular-devkit/schematics@8.3.14
Fetching @angular/cli@8.3.14
Fetching @angular/common@8.2.12
Fetching @angular/compiler@8.2.12
Fetching @angular/compiler-cli@8.2.12
Fetching @angular/core@8.2.12
Fetching @angular/platform-browser@8.2.12
Fetching @angular/platform-browser-dynamic@8.2.12
Fetching @angular/router@8.2.12
Fetching @angular/upgrade@8.2.12
Fetching @schematics/angular@8.3.14
Fetching @nrwl/angular@undefined
Fetching @nrwl/cypress@undefined
Fetching @nrwl/eslint-plugin-nx@undefined
Fetching @nrwl/express@undefined
Fetching @nrwl/jest@undefined
Fetching @nrwl/linter@undefined
Fetching @nrwl/nest@undefined
Fetching @nrwl/next@undefined
Fetching @nrwl/node@undefined
Fetching @nrwl/react@undefined
Fetching @nrwl/tao@undefined
Fetching @nrwl/web@undefined
ENOENT: no such file or directory, open '/var/folders/yn/tfydvv613h95b9364681z6k00000gn/T/tmp-25830QNp94WeWCI3j/node_modules/@angular/cli/@schematics/angular/migrations/migration-collection.json'
Command failed: ./node_modules/.bin/tao migrate @nrwl/workspace
$ npx nx report
  @nrwl/angular : Not Found
  @nrwl/cli : 8.7.1
  @nrwl/cypress : Not Found
  @nrwl/eslint-plugin-nx : Not Found
  @nrwl/express : Not Found
  @nrwl/jest : 8.7.1
  @nrwl/linter : 8.7.1
  @nrwl/nest : 8.7.1
  @nrwl/next : Not Found
  @nrwl/node : 8.7.1
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 8.7.1
  @nrwl/web : Not Found
  @nrwl/workspace : 8.7.1
  typescript : 3.5.3

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 17 (5 by maintainers)

Most upvoted comments

@alfonsobravi I had this issue in a previous migration. What it solved for me was to install the package @nrwl/tao by hand and then rerun the migration. We started with nx pretty early on and this package was added sometime when there was the transation from angular cli only to nx cli afaik. I also used to update just with yarn update, maybe that was also the reason why this package was missing for us. To be totally honest, I am to this day not sure what the preferred way is to keep the repo up to date. I thought now the migrate command should be preferred. But on the release blog (for example here it always states to just use yarn update.

Ran into the same issue trying to upgrade Nx v9.2.4 -> v9.3.0. Had to install @nrwl/tao manually again npm i @nrwl/tao --save-dev.

Well, this error went away after installing npm i @nrwl/tao --save-dev manually. I would think this would be automatically handled for me (Nx release page doesn’t mention any breaking changes updating from v8.7.x to v8.8.3), so not sure if I did the right thing here. I also had to resolve a few peer dependencies for the projects to build again. Here are the results of the latest update command. Not sure if reported absence of @schematics/angular/migrations/migration-collection.json is expected when migrating a small repo from v8.7.1 -> v8.8.3. Please let me know if you think this update went well and I’ll close the issue. Thank you.

npx nx migrate @nrwl/workspace
Fetching meta data about packages.
It may take a few minutes.
Fetching @nrwl/workspace@latest
Fetching @angular-devkit/architect@0.803.14
Fetching @angular-devkit/build-angular@0.803.14
Fetching @angular-devkit/build-webpack@0.803.14
Fetching @angular-devkit/core@8.3.14
Fetching @angular-devkit/schematics@8.3.14
Fetching @angular/cli@8.3.14
Could not find '@schematics/angular/migrations/migration-collection.json' in '@angular/cli'. Skipping it
Fetching @angular/compiler@8.2.12
Fetching @angular/compiler-cli@8.2.12
Fetching @schematics/angular@8.3.14
Fetching @nrwl/jest@8.8.3
Fetching @nrwl/linter@8.8.3
Fetching @nrwl/nest@8.8.3
Fetching @nrwl/node@8.8.3
Fetching @nrwl/tao@8.8.3
Fetching @nrwl/workspace@8.8.3
The migrate command has run successfully.
- package.json has been updated
- there are no migrations to run, so migrations.json has not been created.
$ npx nx report
  @nrwl/angular : Not Found
  @nrwl/cli : 8.8.3
  @nrwl/cypress : Not Found
  @nrwl/eslint-plugin-nx : Not Found
  @nrwl/express : Not Found
  @nrwl/jest : 8.8.3
  @nrwl/linter : 8.8.3
  @nrwl/nest : 8.8.3
  @nrwl/next : Not Found
  @nrwl/node : 8.8.3
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 8.8.3
  @nrwl/web : Not Found
  @nrwl/workspace : 8.8.3
  typescript : 3.5.3

@vsavkin If I run

"npm i @nrwl/workspace@8.8.3 --save-dev"
nx migrate @nrwl/workspace@8.8.3 --from="@nrwl/workspace@8.7.0" 

note I am updating from 8.7.0 I still get error. but this time I get :

Fetching @nrwl/angular@8.8.3
Fetching @nrwl/cypress@8.8.3
Fetching @nrwl/jest@8.8.3
Fetching @nrwl/tao@8.8.3
Invalid Version: 5.2
C:\Users\admin\Desktop\medicalreviewsystem\supplier-ui\src\main\web\node_modules\yargs\yargs.js:1109
      else throw err

We had an issue with the migration command. It has been fixed. You can do the following:

"npm i @nrwl/workspace@8.8.3 --save-dev"
nx migrate @nrwl/workspace@8.8.3 --from="@nrwl/workspace@8.7.1" 

@Tre665 suggestion worked out fine for me, many thanks!

@demisx They are basically the same. nx migrate latest is basically nx migrate @nrwl/workspace@latest (we default the package to @nrwl/workspace if you don’t specify it).