Home > front end >  ERESOLVE unable to resolve dependency tree ionic capacitor
ERESOLVE unable to resolve dependency tree ionic capacitor

Time:11-07

I am trying to build ionic app and this error shows: ionic build

> vue-cli-service build

[INFO] Looks like @vue/cli-service isn't installed in this project.
       
       This package is required for this command to work properly.

? Install @vue/cli-service? Yes
> npm i -D -E @vue/cli-service
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @capacitor/[email protected]
npm ERR! node_modules/@capacitor/core
npm ERR!   @capacitor/core@"2.4.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @capacitor/core@"~2.5.0" from @capacitor/[email protected]
npm ERR! node_modules/@capacitor/android
npm ERR!   @capacitor/android@"^2.4.6" 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 /home/sariful/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sariful/.npm/_logs/2022-11-07T09_21_25_101Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.
        
        npm i -D -E @vue/cli-service exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

CodePudding user response:

USE COMMAND npm install --force for install npm and if you want to install any other dependency then just add --force tag after you command.

CodePudding user response:

The error seem pretty self-explainatory, to point out which part: retry this command with --force, or --legacy-peer-deps Differences between the two:

  • --legacy-peer-deps: ignore all peerDependencies when installing, in the style of npm version 4 through version 6.
  • --force: will force npm to fetch remote resources even if a local copy exists on disk.

For more info: npm: When to use --force and --legacy-peer-deps

From personal experience such similar package issues can be fixed by upgrading NPM version, or I prefer to use NVM so I can switch back and forth the NPM versions, but caution: this can break your other packages, so I suggest you to try the first solution first.

  • Related