An unhandled exception occurred: Cannot find module '@angular-devkit/core'
π Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] xi18n
- [ ] lint
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Description
Update my project from angular cli 8.3.25 to latest version
π¬ Minimal Reproduction
ng update @angular/cli @angular/core
π₯ Exception or Error
[error] Error: Cannot find module '@angular-devkit/core'
Require stack:
- C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js
- C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\models\command-runner.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\lib\init.js
- C:\Users\Giacomo\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\bin\ng
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:19:20
at C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:10:17
at Object. (C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:16:3)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js:22:38
at C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js:10:17
at Object. (C:\Users\Giacomo\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js:16:3)
π Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.1
Node: 13.7.0
OS: win32 x64
Angular: 9.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.1
@angular-devkit/build-angular 0.900.1
@angular-devkit/build-optimizer 0.900.1
@angular-devkit/build-webpack 0.900.1
@angular-devkit/core 9.0.1 (cli-only)
@angular-devkit/schematics 9.0.1
@angular/cdk 8.2.3
@angular/cli 9.0.1
@angular/flex-layout 8.0.0-beta.27
@angular/material 8.2.3
@angular/material-moment-adapter 8.2.3
@angular/pwa
@ngtools/webpack 9.0.1
@schematics/angular 9.0.1 (cli-only)
@schematics/update 0.900.1
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Anything else relevant?
issue solved TY toso82 unistalling and updating pakage did the trick for me
@firegbn : npm update saved my day. Thank you!
In my case 2 commands helped:
npm install --save-dev @angular-devkit/build-angular
npm install --save-dev @angular-devkit/core
You can run the command below
npm install --save-dev @angular-devkit/build-angular
OR check other answers from an unhandled exception occurred: cannot find module '@angular-devkit/build-angular/package.json'
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
Just got the same issue, upgrading from version 10.0.8 to latest 11.0.2
@clydin 's solution worked (the second one: npm install --save-dev @schematics/angular @angular-devkit/core @angular-devkit/schematics, then doing the ng update @angular/cli @angular/core, and then uninstalling those 3 above)
And now I get more files updated by the migration (in my case: all the spec files - it adds waitForAsync - and the main/root routing config - it adds relativeLinkResolution: 'legacy').
Before, with the error, it was only updating tsconfig files of apps and libs and the angular.json file
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.