Update the library in package.json - reactjs

I want to update the libraries in package.json in a batch, so I executed the command ② after executing the command ①.
After that, I executed the yarn command and the libraries were installed, but when I executed npm install after executing the commands (1) and (2), I got an error.
Why does npm install give me an error?
①rm -rf node_modules yarn.lock
② npx npm-check-updates -u
error
npm ERR! react#"18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"^4.12.4" 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 /user/.npm/eresolve-report.txt for a full report.

you have a dependency conflict in your packages.
#material-ui/core#4.12.4 needs react 16/17 but you are using react 18
upgrade to material-ui v5
OR
use --force flag knowing that there may be some breaking changes
npm install --force

Related

I do I resolve the package.jason file error?

Why am I having the below error
PS C:\Users\USER\Desktop\Shareme\shareme_frontend> npm install #sanity/client #sanity/image-url react-google-login react-icons react-loader-spinner react-masonry-css react-router-dom uuid
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: shareme_frontend#0.1.0
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#"^16 || ^17" from react-google-login#5.2.2
npm ERR! node_modules/react-google-login
npm ERR! react-google-login#"*" 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\USER\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\USER\AppData\Local\npm-cache\_logs\2022-06-29T15_11_18_949Z-debug-0.log
react-google-login is not updated to the latest react v18.
Either wait for an update, downgrade react to v17, or use --force flag.
npm i react-google-login --force
Note that by using --force, there is no guarantee that this package will work with v18 of react
react-google-login#5.2.2 is not compatible with react 18 version as 5.2.2 is published year ago as per npm page.
It is still looking for react version of 17 / 16.
Below error block will tell you this:
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16 || ^17" from react-google-login#5.2.2
You can downgrade your react for this specific project via :
deleting node_modules
run npm cache clean
manually update your package.json to change version of react to 17
run npm install

i am getting the following error while installing material-UI in vs code with npm WHAT SHOULD I DO?

npm ERR! node_modules/react
npm ERR! react#"^18.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"*" 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\ayush tawar\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\ayush tawar\AppData\Local\npm-cache_logs\2022-06-10T07_31_54_848Z-debug-0.log
PS C:\Users\ayush tawar\OneDrive\Desktop\twitter clone>
Please try to do like this
npm cache clean
and then
npm install -g node-gyp
npm install --g --production windows-build-tools
Error installing bcrypt with npm
You can also add --verbose flag at the end of npm install which will show more
information about this issue.
if second command will not work, then you should install python to your pc and install this one.
npm install --g windows-build-tools
I believe if you will use ubuntu or mac os, it will be resolved maybe.
Or it could be node version issue, please upgrade node version.
The package is not up to date for react 18.
Just install it with --legacy-peer-deps, this will override the error checking.
npm install #material-ui/core --legacy-peer-deps

Npm dependency issue: react 17.0.2 and "react-swipeable-views": "0.13.9"

I am trying to setup material dashboard from
git clone https://github.com/creativetimofficial/material-dashboard-react.git.
Using node-16
I run npm install
I get
npm ERR! While resolving: material-dashboard-react#1.10.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^15.3.0 || ^16.0.0" from react-swipeable-views#0.13.9
npm ERR! node_modules/react-swipeable-views
npm ERR! react-swipeable-views#"0.13.9" 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/simha/.npm/eresolve-report.txt for a full report.
How can I resolve this.
It looks like the root project installs react#17.0.2. But "react-swipeable-views" requires version 15 or 16 of react.
Edit: As a first option, you could try updating "react-swipeable-views" to its latest version. It may possibly support React 17.
The following command will update it.
npm install react-swipeable-views#latest
If this doesn't work...
Try reducing the numbers for react in the package.json to something in the 16.x.x range, then re-run
npm install
so it will satisfy the peer dependency.
https://docs.npmjs.com/about-semantic-versioning
If you're not familiar with NPM semantic versioning, use this calculator. Enter react -> "^16.0.0" to see that it does not include 17
https://semver.npmjs.com/

Issues Installing Vue-Native with library vue-native-scripts

I am trying to create a project with Vue-Native following the instructions in the documentation:
https://vue-native.io/docs/installation.html
I am trying it with Expo and Vue-React, and in both cases I have the same error when I run "npm start":
Failed to construct transformer: Error: Cannot find module 'vue-native-scripts'
I try to install it with npm install vue-native-scripts --save-dev and I have the error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vuenativetest#0.0.1
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"16.13.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-native#0.64.0
npm ERR! node_modules/react-native
npm ERR! react-native#"^0.64.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 /home/miguel/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/miguel/.npm/_logs/2021-04-04T10_52_07_169Z-debug.log
I updated all libraries: React, React-Native, npm, Node, etc.
But I have the same error.
I am currently working on a vue-native project and encountered this problem when I started.
This seems to be a problem about the dependencies of a vue-native project having sub dependencies of different versions from other dependencies. When NPM sees this it just freaks out.
My solution is to start using yarn! Install it by the following:
$ npm i -g yarn
After its installed, its advised that you delete the project and redo the vue-native-cli init command so it can use yarn from there, but you can also just directly use the following command without deleting the project:
$ yarn install vue-native-scripts

I am trying to install new component using npm. But it gives error

I was trying to add $ npm install react-native-touchable-bounce --save but it was giving an error the same as the following.
then I deleted all node_modules still getting this error.
npm install gives the following error.
PS I:\Code\singal res\code\singalRes> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react-native-svg#12.1.0
npm ERR! node_modules/react-native-svg
npm ERR! react-native-svg#"^12.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-svg#"^9.13.6" from #ui-kitten/components#5.0.0
npm ERR! node_modules/#ui-kitten/components
npm ERR! #ui-kitten/components#"^5.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 C:\Users\softb\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\softb\AppData\Local\npm-cache\_logs\2021-02-14T03_13_39_660Z-debug.log
for me adding the --force flag fixed the issue
npm i --force
maybe it's because of the lib version mismatch, you can delete the package-lock.json and node_modules,
then try npm install again.
Temporary Solution
This issue can be fixed by running npm i your-dependency --force .
This issue occurs because npm can't automatically fix the dependencies
mismatch.
Cause
If you want to know why this happen go here.
Permanent Solution
If you never heard about yarn, its new package manager came after npm. it is very similar to npm and it has many benefits. one of them is it can automatically fix this issue.
How to install yarn.
By the way, there are many new emerging package managers too pnpm and others.

Resources