How to update my gatsby and its dependences - node.js

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.

Related

Conflicting upstream dependencies

I have no idea what I need to do to get NPM install to run successfully after upgrading Node to 18.12.1 and npm to 9.2.0. I keep getting this upstream dependency error. I ran
npm install -g npm-check-updates
ncu -u
npm install
And now this is where I am.
npm install ─╯
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hipersigno#undefined
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.0" from react-svgmt#1.2.0
npm ERR! node_modules/react-svgmt
npm ERR! react-svgmt#"^1.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.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/mchildress/.npm/_logs/2023-01-09T16_27_29_875Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mchildress/.npm/_logs/2023-01-09T16_27_29_875Z-debug-0.log
What's going on is that react-svgmt has react 17 set as a peer dependency. This means that it is built only to support react 17. You have react 18 installed and npm sees that conflict and bails. You have the following options:
Downgrade to React 17 by using npm install --save react#^17.0.0 react-dom#^17.0.0
Indicate that you are okay with having a potentially incompatible version by using npm install --legacy-peer-deps.

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.

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

Not able to install reactstrap

In case of installing react-icons, reactstrap and react-toastify
C:\Users\Anupam K Krishnan\Desktop\React20\four-tictactoe>npm install react-icons reactstrap react-toastify
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"*" from #testing-library/react#11.2.2
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.2" from the root project
npm ERR! peer react#"17.0.1" from react-dom#17.0.1
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"*" from #testing-library/react#11.2.2
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.2" from the root project
npm ERR! react-dom#"^17.0.1" from the root project
npm ERR! 2 more (reactstrap, react-transition-group)
npm ERR! 5 more (the root project, react-icons, react-toastify, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"0.14.x || ^15.0.0 || ^16.0.0" from react-popper#1.3.7
npm ERR! node_modules/reactstrap/node_modules/react-popper
npm ERR! react-popper#"^1.3.6" from reactstrap#8.8.0
npm ERR! node_modules/reactstrap
npm ERR! reactstrap#"*" 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\Anupam K Krishnan\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\Anupam K Krishnan\AppData\Local\npm-cache\_logs\2020-12-25T16_47_42_992Z-debug.log
In case of using --force
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#17.0.1
npm WARN node_modules/react
npm WARN peer react#"*" from #testing-library/react#11.2.2
npm WARN node_modules/#testing-library/react
npm WARN #testing-library/react#"^11.2.2" from the root project
npm WARN 6 more (react-dom, the root project, react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"0.14.x || ^15.0.0 || ^16.0.0" from react-popper#1.3.7
npm WARN node_modules/reactstrap/node_modules/react-popper
npm WARN react-popper#"^1.3.6" from reactstrap#8.8.0
npm WARN node_modules/reactstrap
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#17.0.1
npm WARN node_modules/react
npm WARN peer react#"*" from #testing-library/react#11.2.2
npm WARN node_modules/#testing-library/react
npm WARN #testing-library/react#"^11.2.2" from the root project
npm WARN 6 more (react-dom, the root project, react-icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"0.14.x || ^15.0.0 || ^16.0.0" from react-popper#1.3.7
npm WARN node_modules/reactstrap/node_modules/react-popper
npm WARN react-popper#"^1.3.6" from reactstrap#8.8.0
npm WARN node_modules/reactstrap
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"*" from #testing-library/react#11.2.2
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.2" from the root project
npm ERR! peer react#"17.0.1" from react-dom#17.0.1
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"*" from #testing-library/react#11.2.2
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.2" from the root project
npm ERR! react-dom#"^17.0.1" from the root project
npm ERR! 2 more (reactstrap, react-transition-group)
npm ERR! 5 more (the root project, react-icons, react-toastify, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context#0.3.0
npm ERR! node_modules/reactstrap/node_modules/create-react-context
npm ERR! create-react-context#"^0.3.0" from react-popper#1.3.7
npm ERR! node_modules/reactstrap/node_modules/react-popper
npm ERR! react-popper#"^1.3.6" from reactstrap#8.8.0
npm ERR! node_modules/reactstrap
npm ERR! reactstrap#"*" 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\Anupam K Krishnan\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\Anupam K Krishnan\AppData\Local\npm-cache\_logs\2020-12-25T17_16_41_640Z-debug.log
Also tried adding an .env file with SKIP_PREFLIGHT_CHECK=true
even this doesn't work
All this error is coming while installing reactstrap
What I've tried
1)Deleted node modules and package-lock.json
2)updated npm
3)reinstalled npm
Even I tried --force but nothing happend
Still error is there
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\Users\asus\Desktop\react20\node_modules\babel-eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls babel-eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
If nothing works then run Command :
npm install reactstrap --legacy-peer-deps
To overcome this problem run the above command that overcome that problem

I've downloaded Angular 7 project while my global version is 11 so ng serve , ng update all of them give me errors like that

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: #angular-devkit/build-angular#0.12.4
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1100.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev #angular-devkit/build-angular#"~0.1100.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/compiler-cli#11.0.5
npm ERR! node_modules/#angular/compiler-cli
npm ERR! peer #angular/compiler-cli#"^11.0.0" from #angular-devkit/build-angular#0.1100.5
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"~0.1100.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.
Please try by using the below command :-
npm install --save-dev webpack-dev-server
Or
ng update #angular/cli #angular/core --allow-dirty --force
I solved the same problem downgrading npm to version 6
npm install -g npm#6.14.13
and then update Angular

Resources