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)
@alfonsobravi I had this issue in a previous migration. What it solved for me was to install the package
@nrwl/taoby 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/taomanually againnpm i @nrwl/tao --save-dev.Well, this error went away after installing
npm i @nrwl/tao --save-devmanually. I would think this would be automatically handled for me (Nx release page doesn’t mention any breaking changes updating fromv8.7.xtov8.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.jsonis expected when migrating a small repo fromv8.7.1->v8.8.3. Please let me know if you think this update went well and I’ll close the issue. Thank you.@vsavkin If I run
note I am updating from 8.7.0 I still get error. but this time I get :
We had an issue with the migration command. It has been fixed. You can do the following:
@Tre665 suggestion worked out fine for me, many thanks!
@demisx They are basically the same.
nx migrate latestis basicallynx migrate @nrwl/workspace@latest(we default the package to@nrwl/workspaceif you don’t specify it).