Я выполняю эту команду
ionic capacitor sync android
Но у меня были эти конфликтующие модули ->
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.
Поэтому, когда он запускается -> выполнить npm i
, но я хочу добавить --force
В вашем package.json вы можете определить пользовательские сценарии, которые могут запускать несколько команд друг за другом.
Ниже приведена реализация, которая
Чтобы реализовать, добавьте это в свой package.json:
"scripts":
{
"android": "npm i -force && ionic build && ionic capacitor sync android && ionic capacitor open android"
}
Скрипт можно вызвать с помощью
npm запустить %имя сценария%
Итак, в этом случае:
нпм запустить андроид