ionic-cli: Error: Cannot find module '@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/utils'

Description:

I was trying to start a new ionic project. As my standard procedure, I tried to build an apk before starting to write the business logic, the build failed at ng.cmd run app:ionic-cordova-build:production --platform=android.

Steps to Reproduce:

Step 1: Open powershell in vs code. Step 2: npm install -g @angular/cli @ionic/cli Step 3: cd {location-to-project-parent-directory} Step 4: ionic start (Completed with Angular -> blank template -> not installed capacitor) Step 5: cd {location-to-project-directory} Step 6: Showed 1 vulnerability . So executed npm audit fix as per the instruction on the powershell window. Step 7: ionic cordova build android --prod

Output:

Error: Cannot find module ‘@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/utils’

My ionic info:

Ionic:

   Ionic CLI                     : 6.12.2 (C:\Users\Infobahn Networks\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.5.0
   @angular-devkit/build-angular : 0.1100.2
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 11.0.2
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)

Utility:

   cordova-res (update available: 0.15.2) : 0.15.1
   native-run (update available: 1.2.2)   : 1.0.0

System:

   NodeJS : v14.6.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.14.6
   OS     : Windows 10

Other Information:

[error] Error: Cannot find module '@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/utils'
Require stack:
- {location-to-the-project}\node_modules\@ionic\angular-toolkit\builders\utils\index.js
- {location-to-the-project}\node_modules\@ionic\angular-toolkit\builders\cordova-build\index.js
- {location-to-the-project}\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- {location-to-the-project}\node_modules\@angular-devkit\architect\node\index.js
- {location-to-the-project}\node_modules\@angular\cli\models\architect-command.js
- {location-to-the-project}\node_modules\@angular\cli\commands\run-impl.js
- {location-to-the-project}\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- {location-to-the-project}\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- {location-to-the-project}\node_modules\@angular\cli\utilities\json-schema.js
- {location-to-the-project}\node_modules\@angular\cli\models\command-runner.js
- {location-to-the-project}\node_modules\@angular\cli\lib\cli\index.js
- {location-to-the-project}\node_modules\@angular\cli\lib\init.js
- {location-to-the-project}\node_modules\@angular\cli\bin\ng
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1065:15)
    at Function.Module._load (internal/modules/cjs/loader.js:911:27)
    at Module.require (internal/modules/cjs/loader.js:1125:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> ({location-to-the-project}\node_modules\@ionic\angular-toolkit\builders\utils\index.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:1236:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)
    at Module.load (internal/modules/cjs/loader.js:1085:32)
    at Function.Module._load (internal/modules/cjs/loader.js:950:14)
    at Module.require (internal/modules/cjs/loader.js:1125:19)


About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 23

Most upvoted comments

Try npm i @ionic/angular-toolkit@latest . This worked in my project.

You may also want to try

npm i -D @angular-devkit/build-angular@latest

Once execute npm i @ionic/angular-toolkit@latest, it gives the following error, I am using Apple M1, how to solve it folks? I am stuck and dont know what to do, I am trying to do the build on iOS for the first time, on Android works perfectly on other computer, what should I see on the other computer to make on macbook works?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @angular/compiler-cli@10.0.14
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"~10.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^11.0.0 || ^11.2.0-next" from @angular-devkit/build-angular@0.1102.0
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"^0.1102.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/manel/.npm/eresolve-report.txt for a full report.

Thank you so much

Thanks you! it worked npm i @ionic/angular-toolkit@latest

Thanks. i just lost 2 days looking for a solution and “npm i @ionic/angular-toolkit@latest” juste saved me.