Migration to Nx 11 fails with "Cannot find module '@angular-devkit/core/src/experimental/workspace'"
See original GitHub issueCurrent Behavior
Migration from Nx 10.3 and Angular 10.1.5 fails with Cannot find module '@angular-devkit/core/src/experimental/workspace'
.
Running migration @nrwl/workspace:add-explicit-dep-on-tao
Cannot find module '@angular-devkit/core/src/experimental/workspace'
Require stack:
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@angular-devkit\schematics\src\exception\exception.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@angular-devkit\schematics\src\tree\static.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@angular-devkit\schematics\src\index.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\workspace\src\migrations\update-10-4-0\add-explicit-dep-on-tao.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\tao\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\tao\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\tao\src\commands\migrate.js
- C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\tao\index.js
C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:1132
throw err;
^
Error: Command failed: npx tao migrate --run-migrations=migrations.json
at checkExecSyncError (child_process.js:616:11)
at Object.execSync (child_process.js:652:15)
at Object.handler (C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:76:21)
at Object.runCommand (C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\command.js:196:48)
at Object.parseArgs [as _parseArgs] (C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:1043:55)
at Object.get [as argv] (C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:986:25)
at Object.initLocal (C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\cli\lib\init-local.js:24:13)
at Object.<anonymous> (C:\Users\Marvin\Projekte\nx-tao-migration-issue\node_modules\@nrwl\cli\bin\nx.js:12:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 7272,
stdout: null,
stderr: null
}
Expected Behavior
Migration is successful.
Steps to Reproduce
npx nx migrate latest # or npx nx migrate @nrwl/workspace@latest
npm install
nx migrate --run-migrations=migrations.json
in this demo project: https://github.com/luchsamapparat/nx-tao-migration-issue
Failure Logs
👉🏻 log.txt
Environment
> NX Report complete - copy this into the issue template
Node : 14.15.0
OS : win32 x64
npm : 6.14.8
nx : Not Found
@nrwl/angular : 11.0.20
@nrwl/cli : 10.3.0
@nrwl/cypress : 11.0.20
@nrwl/devkit : 11.0.20
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 11.0.20
@nrwl/linter : 11.0.20
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 10.3.0
@nrwl/web : Not Found
@nrwl/workspace : 11.0.20
typescript : 4.0.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Nx Upgrade from v11 to v12.10.1 is giving "Module not ...
Run command npx nx migrate --run-migrations. Got an error as code: MODULE_NOT_FOUND. "Cannot find module @nrwl/tao/src/utils/app-root".
Read more >Ticket: Migration [Chapter 3] (Cannot find module)
After I run “node movie-last-updated-migration.js” in my CLI, I got an error: internal/modules/cjs/loader.js:584 throw err; ^ Error: Cannot ...
Read more >The ultimate migration guide to angular-eslint ...
json", the following 1 rule(s) did not have known converters in https://github.com/typescript-eslint/tslint-to-eslint-config - nx-enforce-module ...
Read more >Automate Updating Dependencies
Automate Updating Dependencies. The Nx CLI provides the migrate command to help you stay up to date with the latest version of Nx....
Read more >nrwl-nx/community - Gitter
I'm doing an "npm ci" on my code and I'm getting this error: Error: Cannot find module '@nrwl/workspace/src/command-line/supported-nx-commands' Require ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
nx migrate
invokestao migrate
under the hood. It’s just an impl detail. The command I suggested simply runs the latest version of the migration logic cause it gets it from npm.You can use
FORCE_NG_UPDATE
to invoke anyng update
functionality. I personally think thatng update
telling you what to update is a misplaced responsibility.Here is why:
npm/yarn/pnpm
will tell you what to update based on deps and peer deps. If there is a conflict of a dep, you will see a warning or an error (this depends on the version of npm you use) when runningnpm install
.ng update
implements an almost identical mechanism, but now you have two tools that manage the up-to-dateness and the cohesion of your dep graph:npm
andng
. Andnpm
is the only one that really matters. I think ng acting as a package manager is a mistake cause npm6, npm7, yarn1, yarn2, and pnpm all work differently. So you are guaranteed to have disagreements between ng and the package manager you use. Having said that, if you find this functionality useful, you can useFORCE_NG_UPDATE
.@angular/cdk
10x is compatible with Angular 11, but you can update it manually by runningnx migrate @angular/cdk@latest
.Hope it clarifies things.
Could you try the following?
For some reason you have an old version of
@nrwl/tao
:10.3.0
where it should be11.0.20
. One thing you can do as well is to set@nrwl/tao
to 11.0.20 explicitly in package.json before runningnpm install