Unable to resolve dependency conflict error when dockerizing react app - node.js

When I type:
docker build -t dashboard:latest .
It gives this dependency error
code ERESOLVE
#9 83.73 npm ERR! ERESOLVE unable to resolve dependency tree
#9 83.73 npm ERR!
#9 83.73 npm ERR! While resolving: react-berry-admin-template#0.0.4
#9 83.73 npm ERR! Found: react#17.0.2
#9 83.73 npm ERR! node_modules/react
#9 83.74 npm ERR! react#"^17.0.2" from the root project
#9 83.74 npm ERR!
#9 83.74 npm ERR! Could not resolve dependency:
#9 83.74 npm ERR! peer react#"^0.14.0 || ^15.0.0 || ^16.0.0" from react-custom-scrollbars#4.2.1
#9 83.74 npm ERR! node_modules/react-custom-scrollbars
#9 83.74 npm ERR! react-custom-scrollbars#"^4.2.1" from the root project
#9 83.74 npm ERR!
#9 83.74 npm ERR! Fix the upstream dependency conflict, or retry
#9 83.74 npm ERR! this command with --force, or --legacy-peer-deps
#9 83.74 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
I Used –legacy-peer-deps i.e:
npm install --save --legacy-peer-deps
but it didn't fix the issue

Related

Receiving NPM Code EUSAGE error on deployment

I am trying to deploy a simple app to Railway.app
However I get the following error:
The app was working perfectly fine on Heroku before they jacked up the prices.
#11 3.081 npm WARN EBADENGINE Unsupported engine {
#11 3.081 npm WARN EBADENGINE package: 'react-quiz#2.0.0',
#11 3.081 npm WARN EBADENGINE required: { node: '16.14.2' },
#11 3.081 npm WARN EBADENGINE current: { node: 'v16.18.1', npm: '8.19.2' }
#11 3.081 npm WARN EBADENGINE }
#11 3.108 npm ERR! code EUSAGE
#11 3.115 npm ERR!
#11 3.115 npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
#11 3.116 npm ERR!
#11 3.116 npm ERR! Invalid: lock file's #babel/core#7.1.6 does not satisfy #babel/core#7.20.12
#11 3.116 npm ERR! Missing: #ampproject/remapping#2.2.0 from lock file
#11 3.116 npm ERR! Missing: gensync#1.0.0-beta.2 from lock file
#11 3.116 npm ERR! Missing: semver#6.3.0 from lock file
#11 3.116 npm ERR! Missing: #jridgewell/gen-mapping#0.1.1 from lock file
#11 3.116 npm ERR! Missing: #babel/core#7.1.6 from lock file
#11 3.116 npm ERR! Missing: fsevents#1.2.4 from lock file
#11 3.116 npm ERR! Missing: fsevents#1.2.13 from lock file
#11 3.116 npm ERR! Missing: bindings#1.5.0 from lock file
#11 3.116 npm ERR! Missing: file-uri-to-path#1.0.0 from lock file
#11 3.116 npm ERR! Missing: fsevents#2.3.2 from lock file
#11 3.116 npm ERR!
#11 3.116 npm ERR! Clean install a project
#11 3.116 npm ERR!
#11 3.116 npm ERR! Usage:
#11 3.116 npm ERR! npm ci
#11 3.116 npm ERR!
#11 3.116 npm ERR! Options:
#11 3.116 npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
#11 3.116 npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
#11 3.116 npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
#11 3.117 npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
#11 3.117 npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
#11 3.117 npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
#11 3.117 npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
#11 3.117 npm ERR!
#11 3.117 npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
#11 3.117 npm ERR!
#11 3.117 npm ERR! Run "npm help ci" for more info
#11 3.118
#11 3.119 npm ERR! A complete log of this run can be found in:
#11 3.119 npm ERR! /root/.npm/_logs/2023-02-14T10_28_38_117Z-debug-0.log
#11 ERROR: executor failed running [/bin/bash -ol pipefail -c npm ci]: exit code: 1
-----
> [stage-0 7/10] RUN --mount=type=cache,id=s/8d47156c-4108-4aea-a9b5-971f8e281867-/root/npm,target=/root/.npm npm ci:
-----
executor failed running [/bin/bash -ol pipefail -c npm ci]: exit code: 1
Error: Docker build failed
I have tried the following suggestions:
npm install --legacy-peer-deps (I have never actually seen this command work even though I see it suggested all the time)
Deleted package.lock.json and npm install
npm audit fix --force (Another command I see suggested all the time but never seems to do anything)
Does anyone have any workarounds, suggestions etc. ?

My React App is giving this error whenever I try to install any dependencies?

React App is giving this error whenever i try to install any dependency and also tried
uninstall and reinstall NodeJs but its not working. Its very difficult to distinguish error whats happening.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-dfb#1.0.4
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"*" from #testing-library/react#11.2.7
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.7" from the root project
npm ERR! peer react#"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context#0.4.1
npm ERR! node_modules/mini-create-react-context
npm ERR! mini-create-react-context#"^0.4.0" from react-router#5.2.0
npm ERR! node_modules/react-router
npm ERR! react-router#"5.2.0" from react-router-dom#5.2.0
npm ERR! node_modules/react-router-dom
npm ERR! react-router-dom#"^5.2.0" from the root project
npm ERR! 10 more (react-device-detect, react-dom, react-h5-audio-player, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"~16.0.0" from react-dfb#1.0.4
npm ERR! node_modules/react-dfb
npm ERR! react-dfb#"^1.0.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#16.0.0
npm ERR! node_modules/react
npm ERR! peer react#"~16.0.0" from react-dfb#1.0.4
npm ERR! node_modules/react-dfb
npm ERR! react-dfb#"^1.0.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 C:\Users\Md Yasin Ansari\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\Md Yasin Ansari\AppData\Local\npm-cache\_logs\2022-11-13T12_55_52_296Z-debug-0.log

Error while installing dependency in Node.JS

I get this error when I try to install these dependencies:
#material-ui/core
#material-ui/icons
#material-ui/lab
#react-google-maps/api
axios
google-map-react
There is the output:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: travel_advisor#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\Admin\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\Admin\AppData\Local\npm-cache\_logs\2022-07-17T07_18_22_154Z-debug-0.log

react-router-dom ERESOLVE could not resolve

I tried to install the react-router-dom for my mernstack ecommerce website.It got error like this. I tried lot of methods to installing this .But I couldn't.My mernstack application is ecommerce website.
PS A:\my react\mernstack ecommerce\E-Commerce> npm install --save react-router-dom
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: e-commerce#1.0.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"^0.14.9 || ^15.3.0 || ^16.0.0 || ^17.0.0" from #redux-
devtools/core#3.11.0
npm ERR! node_modules/#redux-devtools/core
npm ERR! dev #redux-devtools/core#"^3.11.0" from the root project
npm ERR! peer react#"^16.8.3 || ^17 || ^18" from react-redux#7.2.8
npm ERR! node_modules/react-redux
npm ERR! peer react-redux#"^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" from #redux-
devtools/core#3.11.0
npm ERR! node_modules/#redux-devtools/core
npm ERR! dev #redux-devtools/core#"^3.11.0" from the root project
npm ERR! react-redux#"^7.2.8" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-router-dom#"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#18.0.0
npm ERR! node_modules/react
npm ERR! peer react#"^18.0.0" from react-dom#18.0.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#">=16.8" from react-router-dom#6.3.0
npm ERR! node_modules/react-router-dom
npm ERR! react-router-dom#"*" 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\Kavindra\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\Kavindra\AppData\Local\npm-cache\_logs\2022-04-14T10_55_52_941Z-
debug-0.log
PS A:\my react\mernstack ecommerce\E-Commerce>

ReactJs error installing react-html-table-to-excel

When I tried to install react-html-table-to-excel I am getting this error.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: front#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#"^15.x.x" from react-html-table-to-excel#2.0.0
npm ERR! node_modules/react-html-table-to-excel
npm ERR! react-html-table-to-excel#"*" 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.```
Try this:
npm install --save react-html-table-to-excel --legacy-peer-deps
It worked for me!

Resources