react#experimental 0.0.0 and peer dependencies - node.js

I installed react#experimental which got version 0.0.0-experimental-ee8509801-20230117. Also I have a library with peer dependency react >=0.14
When I run npm i I got following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-jvectormap#0.0.16
npm ERR! Found: react-dom#0.0.0-experimental-ee8509801-20230117
npm ERR! node_modules/react-dom
npm ERR! react-dom#"^0.0.0-experimental-ee8509801-20230117" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-dom#">=0.14" from react-jvectormap#0.0.16
npm ERR! node_modules/react-jvectormap
npm ERR! react-jvectormap#"0.0.16" from the root project
Is that a way to tell npm that this version of react is OK for peer dependency? I tried to use overrides and legacy-peer-deps=true in my .npmrc but got the same error.
Node version v16.19.0, npm version 8.19.3

Finally found out correct configuration using overrides:
"overrides": {
"react": "$react",
"react-dom": "$react-dom"
}

Related

npm run dev not working with webpack/babel conflict

I am trying to run npm run dev for a Vue project but I keep getting the following output:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: babel-loader#7.1.5
npm ERR! Found: webpack#5.75.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"^5.0.0" from css-loader#6.7.2
npm ERR! node_modules/css-loader
npm ERR! dev css-loader#"^6.7.2" from the root project
npm ERR! peer webpack#"^5.20.0" from html-webpack-plugin#5.5.0
npm ERR! node_modules/html-webpack-plugin
npm ERR! dev html-webpack-plugin#"^5.5.0" from the root project
npm ERR! 8 more (postcss-loader, terser-webpack-plugin, url-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"2 || 3 || 4" from babel-loader#7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^7.1.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack#4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"2 || 3 || 4" from babel-loader#7.1.5
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^7.1.1" 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.
I have no idea what to do, I have tried uninstalling vue-cli and tried re-installing it (I'm not sure if this messed up my packages). Is there a way to cleanly delete everything and start fresh? If anyone can help that would be much appreciated!
Update:
I tried starting a new project with vue init webpack frontend in a new folder and tried installing axios and am getting the following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: vuex#4.1.0
npm ERR! Found: vue#2.7.14
npm ERR! node_modules/vue
npm ERR! vue#"^2.5.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vuex#4.1.0
npm ERR! node_modules/vuex
npm ERR! vuex#"^4.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue#3.2.45
npm ERR! node_modules/vue
npm ERR! peer vue#"^3.2.0" from vuex#4.1.0
npm ERR! node_modules/vuex
npm ERR! vuex#"^4.1.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.
I recently updated my version of node (v19.1.0) and npm (v8.19.3), could that be an issue? It generally seems like I am getting a bunch of conflicts every time I try to install new packages. Is there a way to just start clean?
Probably one of your packages is outdated, according to the error. I guess it's the babel loader.
Method 1 Upgrading or Updating your packages might solve the dependency error.
Method 2 Try running npm install --force or npm install --legacy-peer-deps. It should work.

Could not resolve dependency: npm ERR! peer webpack#"^4.0.0" from uglifyjs-webpack-plugin#2.2.0

Here is details of my error:
My node version is 16.13.0 and npm is 8.12.1.
PS D:\ShowCase> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: uglifyjs-webpack-plugin#2.2.0
npm ERR! Found: webpack#5.51.1
npm ERR! node_modules/webpack
npm ERR! dev webpack#"^5.47.1" from the root project
npm ERR! peer webpack#"4.x.x || 5.x.x" from #webpack-cli/configtest#1.0.4
npm ERR! node_modules/#webpack-cli/configtest
npm ERR! #webpack-cli/configtest#"^1.0.4" from webpack-cli#4.8.0
npm ERR! node_modules/webpack-cli
npm ERR! dev webpack-cli#"^4.7.2" from the root project
npm ERR! 3 more (#webpack-cli/configtest, #webpack-cli/info, #webpack-cli/serve)
npm ERR! 8 more (babel-loader, css-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^4.0.0" from uglifyjs-webpack-plugin#2.2.0
npm ERR! node_modules/uglifyjs-webpack-plugin
npm ERR! dev uglifyjs-webpack-plugin#"^2.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack#4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#"^4.0.0" from uglifyjs-webpack-plugin#2.2.0
npm ERR! node_modules/uglifyjs-webpack-plugin
npm ERR! dev uglifyjs-webpack-plugin#"^2.2.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.
Please let me know if anyone has faced the same problem.
Thanks in advance.
The uglifyjs-webpack-plugin will work fine with Webpack 4 but will not work with Webpack 5. Since this plugin is not scheduled for Webpack 5, You better downgrade Webpack from 5 to 4. Or Try other plugins like babel-minify-webpack-plugin or terser-webpack-plugin to minify javascript if you want to use uglifyjs-webpack-plugin specifically to minimize javascript code.
You can check the last stable release of uglifyjs-webpack-plugin was 3 years ago, and no documented development support for Webpack 5.

"ERESOLVE unable to resolve dependency tree" when installing AWS CDK construct library

$ npm i #aws-cdk/aws-ec2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cdk_sample#0.1.0
npm ERR! Found: #aws-cdk/core#1.95.0
npm ERR! node_modules/#aws-cdk/core
npm ERR! #aws-cdk/core#"1.95.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #aws-cdk/core#"1.95.1" from #aws-cdk/aws-iam#1.95.1
npm ERR! node_modules/#aws-cdk/aws-iam
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" from the root project
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-cloudwatch#1.95.1
npm ERR! node_modules/#aws-cdk/aws-cloudwatch
npm ERR! peer #aws-cdk/aws-cloudwatch#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" 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/sean/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/sean/.npm/_logs/2021-03-27T00_41_58_124Z-debug.log
sean#desktop:~/WebstormProjects/cdkSample$ npm i #aws-cdk/aws-ec2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cdk_sample#0.1.0
npm ERR! Found: #aws-cdk/core#1.95.0
npm ERR! node_modules/#aws-cdk/core
npm ERR! #aws-cdk/core#"1.95.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #aws-cdk/core#"1.95.1" from #aws-cdk/aws-iam#1.95.1
npm ERR! node_modules/#aws-cdk/aws-iam
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" from the root project
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-cloudwatch#1.95.1
npm ERR! node_modules/#aws-cdk/aws-cloudwatch
npm ERR! peer #aws-cdk/aws-cloudwatch#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" 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/sean/.npm/eresolve-report.txt for a full report.
The --force option sounds non-ideal. What should be done to fix the upstream dependency conflict? I do know that AWS CDK is very strict when it comes to matching package versions between the core and construct libs.
// project generated via $ cdk init app --language typescript
"devDependencies": {
"#aws-cdk/assert": "1.95.0",
"#types/jest": "^26.0.10",
"#types/node": "10.17.27",
"aws-cdk": "1.95.0",
"jest": "^26.4.2",
"ts-jest": "^26.2.0",
"ts-node": "^9.0.0",
"typescript": "~3.9.7"
},
"dependencies": {
"#aws-cdk/core": "1.95.0",
"source-map-support": "^0.5.16"
}
From comments, installing the dependency with same version as of aws-cdk and #aws-cdk/core solved the issue.
npm install #aws-cdk/aws-ec2#1.95.0

How to update my gatsby and its dependences

I'm new on React and I'm trying to update my gatsby and its dependences but is not working.
On the terminal I have put npm outdated and I got this below.
Package Current Wanted Latest Location Depended by
gatsby 2.32.4 2.32.9 3.0.0 node_modules/gatsby form-gatsby
gatsby-plugin-sass 3.2.0 3.2.0 4.0.0 node_modules/gatsby-plugin-sass form-gatsby
gatsby-source-filesystem 2.11.1 2.11.1 3.0.0 node_modules/gatsby-source-filesystem form-gatsby
gatsby-transformer-remark 2.16.1 2.16.1 3.0.0 node_modules/gatsby-transformer-remark form-gatsby
react 16.13.1 16.14.0 17.0.1 node_modules/react form-gatsby
react-dom 16.13.1 16.14.0 17.0.1 node_modules/react-dom form-gatsby
When I tryind to run this: npm update I got this error below.
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql#15.5.0
npm WARN node_modules/graphql
npm WARN graphql#"^15.4.0" from gatsby#3.0.0
npm WARN node_modules/gatsby
npm WARN gatsby#"3.0.0" from the root project
npm WARN 6 more (gatsby-plugin-image, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql#"^14.4.1" from express-graphql#0.9.0
npm WARN node_modules/express-graphql
npm WARN express-graphql#"^0.9.0" from gatsby#3.0.0
npm WARN node_modules/gatsby
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: gatsby#3.0.0
npm ERR! node_modules/gatsby
npm ERR! gatsby#"3.0.0" from the root project
npm ERR! peer gatsby#"^3.0.0-next.0" from gatsby-plugin-image#1.0.0
npm ERR! node_modules/gatsby-plugin-image
npm ERR! gatsby-plugin-image#"^1.0.0" from gatsby-source-contentful#5.0.0
npm ERR! node_modules/gatsby-source-contentful
npm ERR! gatsby-source-contentful#"^5.0.0" from the root project
npm ERR! 5 more (babel-plugin-remove-graphql-queries, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby#"^2.0.0" from gatsby-plugin-sass#3.2.0
npm ERR! node_modules/gatsby-plugin-sass
user#Users-MacBook-Pro form-gatsby % npm update
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: gatsby-starter-hello-world#0.1.0
npm ERR! Found: gatsby#2.32.9
npm ERR! node_modules/gatsby
npm ERR! gatsby#"^2.26.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby#"^3.0.0-next.0" from gatsby-plugin-sharp#3.0.0
npm ERR! node_modules/gatsby-plugin-sharp
npm ERR! gatsby-plugin-sharp#"^3.0.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/user/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2021-03-02T23_15_17_390Z-debug.log
I have tried to run npm install --force gatsby#3.0.0, but the same didn't work.
Do you guys any way I can update this?
Thanks so much.
Try to run npm install gatsby#latest
And only after that run npm outdated
It means the version you are trying to update to has been found
npm ERR! gatsby#"3.0.0" from the root project
Run gatsby -v to see if version is up to date
For me simply yarn upgrade worked.

How do you properly resolve NPM dependencies in projects that require conflicting versions?

I'm trying to build the playground app for react-native-navigation using instructions here. A simple npm install fails because the peer dependencies have react: "*" and react-native: "*", so today (Jan 2021) NPM tries to install react#17.0.1, but also tries to install react-native#0.63.4, which requires react#16.13.1. I get the following error:
npm ERR! While resolving: react-native-navigation#7.7.0
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"*" from the root project
...
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.13.1" from react-native#0.63.4
npm ERR! node_modules/react-native
npm ERR! peer react-native#"*" from the root project
npm ERR! peer react-native#">=0.59" from #react-native-community/datetimepicker#2.6.2
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR!
Then I tried to resolve this by installing react#16.13.1 in my root project, hoping that NPM would detect and use that version as a peer dependency, but then it turns out #react-native-community/datetimepicker#2.6.2 depends on react-native-windows#^0.6.20, which depends on react#16.11.0, giving me this error instead:
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! dev react#"16.13.1" from the root project
...
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.11.0" from react-native-windows#0.62.20
npm ERR! node_modules/#react-native-community/datetimepicker/node_modules/react-native-windows
npm ERR! optional react-native-windows#"^0.62.0-0" from #react-native-community/datetimepicker#2.6.2
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! dev #react-native-community/datetimepicker#"^2.5.0" from the root project
npm ERR! 1 more (react-native-ui-lib)
npm ERR!
How do I get to the bottom of this? I was expecting everything to just work with npm install. What is the proper way to install a project, or is it common to have to constantly debug dependency conflicts prior to starting a project?
As it turns out, I was using node 15.0.x which is apparently too new. Downgrading to 14.15.1 worked.
I too was using node 15.0.x. Downgrading to 14.x.x worked.
Try doing npm install --legacy-peer-deps

Resources