ERESOLVE unable to resolve dependency tree ionic capacitor - node.js

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: ionic-files#0.0.1
npm ERR! Found: #capacitor/core#2.4.6
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/android#2.5.0
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.

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.

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

I'm getting the following error while typing npm install and trying to do project setup? [duplicate]

This question already has an answer here:
Unable to Install and configure the MDX transformer plugin (and dependencies) in gatsby site
(1 answer)
Closed 24 days ago.
I'm getting the following errors while using the command npm install.
I'm new to gatsby and react don't know how resolve.
pegasus#pegasus:~/Documents/MyWebsite/blog-main$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: gatsby-plugin-mdx#5.5.0
npm ERR! Found: #mdx-js/react#1.6.22
npm ERR! node_modules/#mdx-js/react
npm ERR! #mdx-js/react#"^1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #mdx-js/react#"^2.0.0" from gatsby-plugin-mdx#5.5.0
npm ERR! node_modules/gatsby-plugin-mdx
npm ERR! dev gatsby-plugin-mdx#"^5.5.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #mdx-js/react#2.2.1
npm ERR! node_modules/#mdx-js/react
npm ERR! peer #mdx-js/react#"^2.0.0" from gatsby-plugin-mdx#5.5.0
npm ERR! node_modules/gatsby-plugin-mdx
npm ERR! dev gatsby-plugin-mdx#"^5.5.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!
npm ERR! For a full report see:
npm ERR! /home/pegasus/.npm/_logs/2023-01-27T07_02_53_230Z-eresolve-report.txt
Seems, version compatibility issue, You have few options to resolve this issue:
Upgrade the version of #mdx-js/react package: You can try to upgrade the version of #mdx-js/react package in your project to a version that is compatible with gatsby-plugin-mdx by running the command npm install #mdx-js/react#2.x.x
Downgrade the version of gatsby-plugin-mdx package: You can try to downgrade the version of gatsby-plugin-mdx package in your project to a version that is compatible with the current version of #mdx-js/react package by running the command npm install gatsby-plugin-mdx#x.x.x.
Use --force or --legacy-peer-deps: You can also use npm install --force or npm install --legacy-peer-deps to ignore the peer dependency conflict and install the packages, but this option can lead to unexpected behavior and it's not recommended.
use npm install --legacy-peer-deps

Ionic start fails because of dependency issue

I just installed Ionic with
npm install -g #ionic/cli
When I try to run
ionic start ionic-test-app
the initialization fails with a npm dependency error.
Something about a wrong version of a package called postcss.
$ ionic start ionic-test-app
Pick a framework! ๐Ÿ˜
Please select the JavaScript framework to use for your new app. To bypass this prompt next time,
supply a value for the --type option.
? Framework: Angular
Let's pick the perfect starter template! ๐Ÿ’ช
Starter templates are ready-to-go Ionic apps that come packed with everything you need to build your
app. To bypass this prompt next time, supply template, the second argument to ionic start.
? Starter template: blank
? ./ionic-test-app exists. Overwrite? Yes
โœ” Preparing directory ./ionic-test-app in 6.79ms
โœ” Downloading and extracting blank starter in 188.52ms
? Integrate your new app with Capacitor to target native iOS and Android? Yes
> ionic integrations enable capacitor --quiet -- ionic-test-app io.ionic.starter
> npm i --save -E #capacitor/core#latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: postcss#8.2.14
npm ERR! node_modules/postcss
npm ERR! postcss#"8.2.14" from #angular-devkit/build-angular#0.1102.13
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1102.4" from the root project
npm ERR! peer #angular-devkit/build-angular#"^0.1102.4" from #ionic/angular-toolkit#3.1.1
npm ERR! node_modules/#ionic/angular-toolkit
npm ERR! dev #ionic/angular-toolkit#"^3.1.1" from the root project
npm ERR! peer postcss#"^8.1.0" from autoprefixer#10.2.4
npm ERR! node_modules/autoprefixer
npm ERR! autoprefixer#"10.2.4" from #angular-devkit/build-angular#0.1102.13
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1102.4" from the root project
npm ERR! 1 more (#ionic/angular-toolkit)
npm ERR! 9 more (css-loader, cssnano, postcss-import, postcss-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer postcss#"^8.2.15" from cssnano-preset-default#5.1.0
npm ERR! node_modules/cssnano/node_modules/cssnano-preset-default
npm ERR! cssnano-preset-default#"^5.0.1" from cssnano#5.0.2
npm ERR! node_modules/cssnano
npm ERR! cssnano#"5.0.2" from #angular-devkit/build-angular#0.1102.13
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1102.4" from the root project
npm ERR! 1 more (#ionic/angular-toolkit)
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/sekthor/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/sekthor/.npm/_logs/2021-05-20T17_05_21_790Z-debug.log
[ERROR] An error occurred while running subprocess npm.
npm i --save -E #capacitor/core#latest exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Installing dependencies may take several minutes.
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Ionic Advisory, tailored solutions and expert services by Ionic
Go to market faster ๐Ÿ†
Real-time troubleshooting and guidance ๐Ÿ’
Custom training, best practices, code and architecture reviews ๐Ÿ”Ž
Customized strategies for every phase of the development lifecycle ๐Ÿ”ฎ
๐Ÿ‘‰ https://ion.link/advisory ๐Ÿ‘ˆ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
> npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: postcss#8.2.14
npm ERR! node_modules/postcss
npm ERR! postcss#"8.2.14" from #angular-devkit/build-angular#0.1102.13
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1102.4" from the root project
npm ERR! peer #angular-devkit/build-angular#"^0.1102.4" from #ionic/angular-toolkit#3.1.1
npm ERR! node_modules/#ionic/angular-toolkit
npm ERR! dev #ionic/angular-toolkit#"^3.1.1" from the root project
npm ERR! peer postcss#"^8.1.0" from autoprefixer#10.2.4
npm ERR! node_modules/autoprefixer
npm ERR! autoprefixer#"10.2.4" from #angular-devkit/build-angular#0.1102.13
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1102.4" from the root project
npm ERR! 1 more (#ionic/angular-toolkit)
npm ERR! 9 more (css-loader, cssnano, postcss-import, postcss-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer postcss#"^8.2.15" from cssnano-preset-default#5.1.0
npm ERR! node_modules/cssnano/node_modules/cssnano-preset-default
npm ERR! cssnano-preset-default#"^5.0.1" from cssnano#5.0.2
npm ERR! node_modules/cssnano
npm ERR! cssnano#"5.0.2" from #angular-devkit/build-angular#0.1102.13
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1102.4" from the root project
npm ERR! 1 more (#ionic/angular-toolkit)
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/sekthor/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/sekthor/.npm/_logs/2021-05-20T17_05_28_760Z-debug.log
[ERROR] An error occurred while running subprocess npm.
npm i exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I am fairly new to npm and I can't seem to find a solution on this site or anywhere else on the internet.
I have tried both the --force and --legacy-peer-deps, but received the same error.
What is the reason for this error and how do I fix it?
My node, npm & ionic versions are:
$ node --version
v16.2.0
$ npm --version
7.13.0
$ ionic --version
6.16.1
That was my first guess - installing a more recent version of postcss, but unfortunately that did not solve it for me. Solution was downgrading from npm's version 7 to version 6.
npm install -g npm#6
For some reason I couldn't get it to work on node version 16.2.0.
However, using node version manager nvm I installed a second instance of node, the LTS version 14.17.0.
With this downgrade, the setup process works.
nvm install 14.17.0
I ran into this error and manually installing postcss npm i postcss fixed it as the stack trace shows a dependency was relying on the latest version of postcss version 8.2.15 and what was found was version 8.2.14.
Had a similar issue with node start using npm v7.5.2 and was fixed by upgrading to v7.22.0.

npm install error while use webpack, Could not resolve dependency

The error as follows:
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: webpack#3.12.0
npm ERR! node_modules/webpack
npm ERR! dev webpack#"^3.5.6" from the root project
npm ERR! peer webpack#"2 || 3 || 4" from _babel-loader#7.1.5#babel-loader#7.1.5
npm ERR! node_modules/_babel-loader#7.1.5#babel-loader
npm ERR! 5 more (_html-webpack-plugin#2.30.1#html-webpack-plugin, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^2.0.0" from _strip-pragma-loader#1.0.0#strip-pragma-loader#1.0.0
npm ERR! node_modules/_strip-pragma-loader#1.0.0#strip-pragma-loader
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/agou-ops/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/agou-ops/.npm/_logs/2021-04-12T02_49_11_062Z-debug.log
debug.log file content:
packge version and system
npm: 7.6.3
webpack: 3.12.0
system: Ubuntu 20.04
How should I fix it?
npm#7 has stricter dependency resolution than previous versions. If you can update the version of webpack in your root project, that may resolve it. An alternative easy quick thing to try is npm install --legacy-peer-deps.
I met the same problem.
try to run the command with --force , if you don't use the related package.
e.g.
npm install --verbose --force
For npm v7+. It is due to missing dependencies for entries mentioned in the package.json file
use:
npm i --force
or
npm i --legacy-peer-deps
to override peer dependency.
Answered in
Downgrade to a lower npm version with, for example,
npm install npm#6

I need some help in getting my first open source project running

I needed some help in getting my first open source project that I want to work on to run on my machine. I have a 2018 MacBook Pro 15โ€ running Big Sur 11.1 (20C69). I am using VS Code as my IDE. I have forked and cloned the repository for my project.
I have followed the instructions on how to get the app to run here:
https://github.com/bancodobrasil/stop-analyzing-embed
Here are the instructions on how to contribute:
https://github.com/bancodobrasil/stop-analyzing-embed/blob/master/CONTRIBUTING.md
This is the issue I have been assigned, and I am going to work on:
https://github.com/bancodobrasil/stop-analyzing-embed/issues/72
I have first run โ€œnpm installโ€ and then โ€œnpm run devโ€.
Here are the errors I get in terminal:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
ShoaibKhansMBP:stop-analyzing-embed shoaibkhan$ cd app
ShoaibKhansMBP:app shoaibkhan$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: stop-analyzing-embed#0.2.0
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"^16.13.1" from the root project
npm ERR! peer react#">=16.9.0" from #testing-library/react-hooks#3.3.0
npm ERR! node_modules/#testing-library/react-hooks
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-test-renderer#17.0.1
npm ERR! node_modules/react-test-renderer
npm ERR! peer react-test-renderer#">=16.9.0" from #testing-library/react-hooks#3.3.0
npm ERR! node_modules/#testing-library/react-hooks
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/shoaibkhan/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/shoaibkhan/.npm/_logs/2021-01-26T14_56_13_324Z-debug.log
ShoaibKhansMBP:app shoaibkhan$ npm run dev
stop-analyzing-embed#0.2.0 dev
REACT_APP_BACKEND_URL=http://localhost:8008 yarn start
sh: yarn: command not found
npm ERR! code 127
npm ERR! path /Users/shoaibkhan/Documents/Treehouse/Open Source Projects/stop-analyzing-embed/app
npm ERR! command failed
npm ERR! command sh -c REACT_APP_BACKEND_URL=http://localhost:8008 yarn start
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/shoaibkhan/.npm/_logs/2021-01-26T14_56_33_589Z-debug.log
ShoaibKhansMBP:app shoaibkhan$
Can someone please help me to get this running.
Thanks,
Shoaib Kamal Khan
The error message tells us that yarn is not installed. Looking at the dev script inside the package.json we can see the actual command that is run:
"dev": "REACT_APP_BACKEND_URL=http://localhost:8008 yarn start",
The problem is that it's not listed as a (dev-) dependency in the package.json (you might want to create a PR for that), hence you don't get it installed when doing npm i .
To fix this and install yarn, you should run the following:
npm i -D yarn or install it globally using npm i -g yarn.

How do I fix this NPM dependency issue for react-native-spotify-remote

I'm having trouble figuring out how to resolve a dependency related issue I'm having. I'm trying to install the npm module react-native-spotify-remote within a fresh React Native project and I am getting the following error:
$ npx react-native init test && cd test
$ npm i --save react-native-spotify-remote
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test#0.0.1
npm ERR! Found: react-native#0.63.3
npm ERR! node_modules/react-native
npm ERR! react-native#"0.63.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native#"^0.61.5" from react-native-spotify-remote#0.3.2
npm ERR! node_modules/react-native-spotify-remote
npm ERR! react-native-spotify-remote#"*" 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\xxx\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\xxx\AppData\Local\npm-cache\_logs\2020-11-15T13_40_38_674Z-debug.log
As I read this error, it seems to me that it is saying that react-native-spotify-remote has a dependency of react-native at version 0.61.5 or higher, and version 0.63.3 is installed. Does that not mean the dependency is satisfied? I know that by downgrading react-native to an earlier version, as used in their example app, I could probably resolve this issue, but I want to try understand why this won't work first and I would ideally like to use the latest version.
Using the --force or --legacy-peer-deps flags does not solve the issue either.
I've also opened an issue on the GitHub repo but no luck there so far either.
Looks like itโ€™s a problem with Peer Dependencies with npm, try:
npm install --legacy-peer-deps

Resources