Updating Nx following https://nx.dev/angular/guides/update guide goes without errors.
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/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @schematics/[email protected]
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
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/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular/[email protected]
Could not find '@schematics/angular/migrations/migration-collection.json' in '@angular/cli'. Skipping it
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @schematics/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
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
We had an issue with the migration command. It has been fixed. You can do the following:
"npm i @nrwl/[email protected] --save-dev"
nx migrate @nrwl/[email protected] --from="@nrwl/[email protected]"
@vsavkin If I run
"npm i @nrwl/[email protected] --save-dev"
nx migrate @nrwl/[email protected] --from="@nrwl/[email protected]"
note I am updating from 8.7.0
I still get error. but this time I get :
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Invalid Version: 5.2
C:\Users\admin\Desktop\medicalreviewsystem\supplier-ui\src\main\web\node_modules\yargs\yargs.js:1109
else throw err
I ended up updating package.json by hand. changed all nrwl 8.7.0 versions to 8.8.3. Also changed cypress to 3.5.0 since I was getting error on windows (cypress Issue 5241)
Experiencing the same issue. In my case I'm upgrading from @nrwl/[email protected].
I ran: npm i @nrwl/[email protected] --save-dev and then npm run nx -- migrate @nrwl/[email protected] --from="@nrwl/[email protected]". This is the result:
Fetching meta data about packages.
It may take a few minutes.
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @nrwl/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @ngrx/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular-devkit/[email protected]
Fetching @angular/[email protected]
Could not find '@schematics/angular/migrations/migration-collection.json' in '@angular/cli'. Skipping it
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @angular/[email protected]
Fetching @schematics/[email protected]
Invalid Version: 5.2
/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/workspace/node_modules/yargs/yargs.js:1109
else throw err
^
Error: Command failed: ./node_modules/.bin/tao migrate @nrwl/[email protected] --from=@nrwl/[email protected]
at checkExecSyncError (child_process.js:621:11)
at Object.execSync (child_process.js:658:15)
at Object.handler (/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:99:21)
at Object.runCommand (/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/workspace/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/workspace/node_modules/yargs/yargs.js:1022:30)
at Object.get [as argv] (/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/workspace/node_modules/yargs/yargs.js:965:21)
at Object.initLocal (/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/cli/lib/init-local.js:18:26)
at Object.<anonymous> (/Users/cgcladera/Projects/@vancast/vancast-cloud-video/node_modules/@nrwl/cli/bin/nx.js:9:18)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 46296,
stdout: null,
stderr: null
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] nx: `nx "migrate" "@nrwl/[email protected]" "--from=@nrwl/[email protected]"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] nx script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cgcladera/.npm/_logs/2019-12-20T08_48_47_104Z-debug.log
Before I found this issue I just tried npm run nx -- migrate @nrwl/workspace and I got the same error although les "verbose". Just got "Invalid Version: null".
Sorry folks. It took us a few iterations to fix the migrate command, but it's a lot more stable now. If you try the same with Nx 8.12.7 or Nx 9.0.2, you should not see any problems migrating.
I understand that you might have migrated manually by now. If that's the case, I'm going to close the issue.
I am running nx migrate --run-migrations=migrations.json after workspace migrate has succesfully migrated from 8.11.1 to @latest (9.0.2) and getting:
Running migration @nrwl/cypress:update-8.12.0
Schematic "update-8.12.0" not found in collection "@nrwl/cypress".
...
Error: Command failed: .\node_modules\.bin\tao migrate --run-migrations=migrations.json
Anyone else?
@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.
@Tre665 suggestion worked out fine for me, many thanks!
@Tre665 You should be using nx migrate latest to keep up to date. It is a lot more stable now, and we'll likely make yarn update run the same command -- it already does for non-Angular workspaces.
@jaysoo Thank you for the clarification! In the last update we run just yarn update again (cause we thought that the difference would be just that it automatically runs the migration). Will update our internal docs with your recommendation.
@jaysoo The Updating NX docs show command as nx migrate @nrwl/workspace. Is nx migrate latest now preferred or are they the same?
@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).
@jaysoo Got it. Thank you for clarifying it.
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.
Folks. I'm going to close this issue. @nrwl/tao has been added as a dependency to @nrwl/cli, so you should not have to install it manually. If you still having problems migrating, please open another issue. Thank you!
Most helpful comment
@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.