Issue
I execute this command
ionic capacitor sync android
But i had this conflictive modules ->
C:\Users\DELL\Documents\inspecciones\inpecciones-app>ionic capacitor sync android
> npm.cmd i -E @capacitor/[email protected]
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/[email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"~12.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.1.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.1.5" 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 C:\Users\DELL\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-02-14T21_22_36_075Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.
npm.cmd i -E @capacitor/[email protected] exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
So when it runs -> execute an npm i
but i want to add an --force
Solution
In your package.json you can define custom scripts that can run multiple commands after each other.
Below is an Implementation that
- installs npm Packages with -force flag
- builds your ionic project
- syncs your ionic build with your android build
- opens android studio with your android project
To implement add this to your package.json:
"scripts":
{
"android": "npm i -force && ionic build && ionic capacitor sync android && ionic capacitor open android"
}
The script can be called with
npm run %script name%
So in this case:
npm run android
Answered By - Greencoms
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.