Error: Cannot find module '@angular-devkit/core' in Angular 9

Dung Do Tien Aug 22 2021 201

Hello, I have a small project with Angular. Everything is still well done for me when I try to get the source from git and run it on another pc.  I get an error throw Error: Cannot find module '@angular-devkit/core'.

[error] Error: Cannot find module '@angular-devkit/core'
Require stack:
- C:\Users\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js
- C:\Users\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js
- C:\Users\TL0945\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\TL0945\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\TL0945\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\TL0945\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\models\command-runner.js
- C:\Users\TL0945\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\TL0945\AppData\Local\Temp\.ng-temp-packages-4EE2gk\node_modules\@angular\cli\lib\init.js
- C:\Users\TL0945\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\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:19:20
    at C:\Users\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:10:17
    at Object. (C:\Users\TL0945\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\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js:22:38
    at C:\Users\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js:10:17
    at Object. (C:\Users\TL0945\Documents\Progetti\Angular\forMca\node_modules\@angular\core\schematics\migrations\move-document\index.js:16:3)

This is my 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

Please help me, how can I resolve this issue?

Thanks for any suggestions.

Have 3 answer(s) found.
  • จักรพงษ์ รักษาศรี Aug 22 2021

    You can try with:

    npm cache clean --force

    npm install

    And it works.

  • Q

    Quoc Tin Nguyen Aug 22 2021

    I got the same error and I tried 2 commands below:

    npm install --save-dev @angular-devkit/build-angular

    npm install --save-dev @angular-devkit/core

    And it works for me.

  • D

    Dương Trang Quốc Aug 22 2021

    You just can try with npm update command to help resolve your issue.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close