Today I worked on a react web project. So it worked fine.And then after that I created a another react project. But in that there was no any package.lock file. So I created manually it by using npm install . But after that when I'm adding dependency to that project with npm i react-particles-js command I got a error msg like this.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: smart-parking-system#0.1.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#"^16.0.0" from react-particles-js#3.5.3
npm ERR! node_modules/react-particles-js
npm ERR! react-particles-js#"*" 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.LAPTOP-3EBUUP6S\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.LAPTOP-3EBUUP6S\AppData\Local\npm-cache\_logs\2021-09-02T11_17_21_426Z-debug.log
Also when I'm creating package.lock file manually I get this log message.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated sane#4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
changed 87 packages, and audited 1703 packages in 40s
So the problem is why I'm not getting a package.lock file automatically and why I can't install dependencies correctly?
It can be because creat-react-app is using yarn now.
Instead of npm install use yarn
Instead of npm i react-particles-js use yarn add react-particle-js
You can confirm if you have a yarn.lock file
Related
PS C:\Users\misss\tnodejs_ec> npm install #material-ui/core
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: tnodejs_ec#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.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\misss\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\misss\AppData\Local\npm-cache_logs\2022-07-04T09_27_24_111Z-debug-0.log
PS C:\Users\misss\tnodejs_ec>
If you really want to install material UI then use force to npm no matter what happen you have to install this forcefully.
npm install #material-ui/core --force
MUI doesn't work with React18, its because of an issue in previous release of MUI, now its been fixed in the latest version.
If you want to stick to #material-ui/core#4.12.4 then your best bet is to include the --legacy-peer-deps option. I got it working after adding this option like
npm install #material-ui/core --legacy-peer-deps
However, the best way forward is to update to the latest MUI version. Current version of MUI is v5.10.1
PS: with recent updates the name of the package in NPM registry has been updated too
old: #material-ui/core
new: #mui/material
Don't forget to update your package.json
When running npm i in one of my projects I get the follow error:
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#"^16.13.1" from react-qr-barcode-scanner#1.0.6
npm ERR! node_modules/react-qr-barcode-scanner
npm ERR! react-qr-barcode-scanner#"*" 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 read about the overrides property in package.json but this only seems to work for overriding "regular" dependencies.
I do also know that I can simply run npm i --legacy-peer-deps as the error suggests but I can't help but wonder:
Is there a way to override a dependencies peer dependencies without requiring --legacy-peer-deps?
This is a known issue, seems like author dropped support for this package.
You can replace with forked one to solve this problem, created by #steima
https://www.npmjs.com/package/#steima/react-qr-barcode-scanner
npm update ; npm i --force
secondly. your next option is clear package.json. and npm init. and try installing latest versions of all dependencies. and never upgrade until absolutely necessary.
I've been working on my react project and am unable to update or install new packages without my computer making a ton of noise. I know it has something to do with the versions of react-dom and react-router-dom but I am not sure the best way to fix it. I just don't want to screw anything up further. Any help or guidance is appreciated!
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: my-app#0.1.0
npm WARN Found: react#17.0.2
npm WARN node_modules/react
npm WARN peer react#"*" from #testing-library/react#11.2.7
npm WARN node_modules/#testing-library/react
npm WARN #testing-library/react#"^11.2.2" from the root project
npm WARN 5 more (mini-create-react-context, react-dom, react-router, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"17.0.2" from react-dom#17.0.2
npm WARN node_modules/react-dom
npm WARN peer react-dom#"*" from #testing-library/react#11.2.7
npm WARN node_modules/#testing-library/react
npm WARN 1 more (the root project)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: my-app#0.1.0
npm WARN Found: react#17.0.2
npm WARN node_modules/react
npm WARN peer react#"*" from #testing-library/react#11.2.7
npm WARN node_modules/#testing-library/react
npm WARN #testing-library/react#"^11.2.2" from the root project
npm WARN 5 more (mini-create-react-context, react-dom, react-router, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#">=15" from react-router-dom#5.3.0
npm WARN node_modules/react-router-dom
npm WARN react-router-dom#"^5.2.0" from the root project
These errors popped up after deleting node_modules and package-lock.json.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app#0.1.0
npm ERR! Found: react#undefined
npm ERR! node_modules/react
npm ERR! react#"^17.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#">=15" from react-router-dom#5.3.0
npm ERR! node_modules/react-router-dom
npm ERR! react-router-dom#"^5.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! See /Users/cherie/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
To update all packages to a new major version, install the npm-check-updates package globally:
npm install -g npm-check-updates
then run it:
ncu -u
this will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version.
then run this :
npm update
The project has been setup using an older version of NodeJS and NPM, the package manager, so it was more lax about dependencies than the current version. When working with older projects, you can use a CLI flag:
npm install --legacy-peer-deps
Just like the error actually tells you. If that is not enough, and the project is just bad as far as dependencies go, you can also use the other flag it's proposing:
npm install --force
Both of those flags relax the dependency resolution checks to work more like older version of the package manager.
This way, you can at least install the project and then you can spent some time on maintenance to fix the issues with mismatched dependency versions and ranges.
I downloaded the project from the internet, when I tried to install the node module, It threw the following
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code ETARGET
npm ERR! notarget No matching version found for npm#0.1.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bhar\AppData\Local\npm-cache\_logs\2022-02-08T18_02_29_482Z-debug.log
PS C:\Users\bhar\Downloads\tryDo\trydo-template\trydo> npm install -g npm#"0.1.0"
npm ERR! code ETARGET
npm ERR! notarget No matching version found for npm#0.1.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bhar\AppData\Local\npm-cache\_logs\2022-02-08T18_02_58_538Z-debug.log```
I am getting errors trying to run npm install on a node/react app which I am taking over development of.
I'm not trying to install any packages globally. I am on an M1 Macbook Pro running Big Sur. I did a fresh install of node and npm with Homebrew. I also tried removing the package-lock.json file, cleaning the npm cache, and adding a .npmignore file to the directory as some other posts have suggested; none of these worked.
Here is the output when I run npm install
MacBook-Pro-2 frontend % npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [my project name]-dashboard#0.1.0
npm ERR! Found: webpack#5.39.0
npm ERR! node_modules/webpack
npm ERR! webpack#"5.39.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^4.0.0" from optimize-css-assets-webpack-plugin#6.0.0
npm ERR! node_modules/optimize-css-assets-webpack-plugin
npm ERR! optimize-css-assets-webpack-plugin#"6.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/<name>/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<name>/.npm/_logs/2021-06-15T17_41_19_910Z-debug.log
I tried to run npm install --legacy-peer-deps, which causes a slightly different error:
MacBook-Pro-2 frontend % npm install --legacy-peer-deps
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/pinpoint#1.0.2: Moved to 'npm install #sideway/pinpoint'
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated #hapi/formula#1.2.0: Moved to 'npm install #sideway/formula'
npm WARN deprecated topojson#3.0.2: Use topojson-client, topojson-server or topojson-simplify directly.
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/joi#16.1.8: Switch to 'npm install joi'
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/<name>/Developer/<directory>/frontend/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/<name>/Developer/<directory>/frontend/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<name>/.npm/_logs/2021-06-15T17_41_57_785Z-debug.log
I solved my own problem. I think this is a common error message, with many potential solutions; here are 2 things I tried that fixed the issue for me:
Make sure you have postgresql installed (if your project includes a postgresql db, like mine). On a mac with homebrew, just run brew install postgresql.
I also downgraded my version of Node.js to the most up-to-date long term support version (previously I was using the dev version). At the time of writing the LTS version was 14.7.
After making these changes, I was able to get my site to install and start correctly.