Getting these WARN despite having the superior version of React - node.js

While attempting some tests with #testing-library-react I tried to -unsuccesfully- install msw I noticed these npm WARN:
npm WARN airbnb-prop-types#2.16.0 requires a peer of react#^0.14 || ^15.0.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-adapter-react-16#1.15.6 requires a peer of react#^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-adapter-react-16#1.15.6 requires a peer of react-dom#^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN react-test-renderer#16.14.0 requires a peer of react#^16.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-adapter-utils#1.14.0 requires a peer of react#0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0 but none is installed. You must install peer dependencies yourself.
following to npm ERR!
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\#open-draft\until
npm ERR! dest C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\#open-draft\.until.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\#open-draft\until' -> 'C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\#open-draft\.until.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
I don't understand what im getting required a peer of react when my current react and react-dom version is 17.0.2. So I'm not quite sure how to fix those WARN which apparently are not letting me to install related packages.
I've already tried deleting node_modules, package.json.lock, running npm cache clean and npm i with not much luck.
If I npm list I'd get at the end the same:
npm ERR! peer dep missing: react#^16.0.0-0, required by enzyme-adapter-react-16#1.15.6
npm ERR! peer dep missing: react-dom#^16.0.0-0, required by enzyme-adapter-react-16#1.15.6
npm ERR! peer dep missing: react#^16.14.0, required by react-test-renderer#16.14.0
npm ERR! peer dep missing: react#0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0, required by enzyme-adapter-utils#1.14.0
npm ERR! peer dep missing: react#^0.14 || ^15.0.0 || ^16.0.0-alpha, required by airbnb-prop-types#2.16.0
Package.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production",
"test": "jest --watchAll"
},
"devDependencies": {
"#babel/preset-react": "^7.12.13",
"#testing-library/jest-dom": "5.11.9",
"#testing-library/react": "^11.2.5",
"axios": "^0.21.1",
"bootstrap": "^4.6.0",
"jquery": "^3.2",
"laravel-mix": "^6.0.13",
"lodash": "^4.17.21",
"popper.js": "^1.16.1",
"postcss": "^8.2.8",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"resolve-url-loader": "^3.1.2",
"sass": "^1.32.8",
"sass-loader": "^8.0.2"
},
"dependencies": {
"#babel/plugin-transform-runtime": "^7.13.10",
"#fortawesome/fontawesome-svg-core": "^1.2.35",
"#fortawesome/free-brands-svg-icons": "^5.15.3",
"#fortawesome/free-solid-svg-icons": "^5.15.3",
"#fortawesome/react-fontawesome": "^0.1.14",
"downshift": "^6.1.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.6.1",
"jest": "^26.6.3",
"react-bootstrap": "^1.5.0",
"react-multi-carousel": "^2.6.2",
"react-paginate": "^7.1.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-select": "^4.3.0",
"react-test-renderer": "^17.0.2",
"react-toastify": "^7.0.3"
},
"babel": {
"presets": [
"#babel/preset-react",
"#babel/preset-env"
],
"plugins": [
"#babel/plugin-transform-react-jsx",
"#babel/plugin-transform-runtime"
]
}
}

Well, apparently running the last version of react andd react-dom which is atm 17.0.2 was not the best idea. I rolled back to the 16.14.0 and everything is working fine.
I found here (How to fix Npm missing peer dependency) that the ^ is kind of misleading.
ie:
requires a peer of react#^15.0.0 || ^16.0.0
Meaning that it requires >15.0.0 but < 17.0.

Related

Upgrading to react 18 results in package dependencies errors

I have the following package.json file:
{
"name": "web",
"version": "0.1.0",
"private": true,
"dependencies": {
"#emotion/react": "^11.10.0",
"#emotion/styled": "^11.10.0",
"#fontsource/roboto": "^4.5.7",
"#mui/icons-material": "^5.8.4",
"#mui/lab": "^5.0.0-alpha.93",
"#mui/material": "^5.9.3",
"#reduxjs/toolkit": "^1.8.3",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"animate.css": "^4.1.1",
"generate-password-browser": "^1.1.0",
"notistack": "^2.0.5",
"query-string": "^7.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.2",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"string-to-color": "^2.2.2",
"stylis-plugin-rtl": "^2.1.1",
"traverse": "^0.6.6",
"typed.js": "^2.0.12",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
I have created this project using create-react-app just now, so everything is clean and new, I have only installed additional packages.
Now, I want to install the following package:
react-swipeable-views
Which had over 260,000 downloads this week,
$ npm i react-swipeable-views
and I'm getting this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: web#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#"^15.3.0 || ^16.0.0 || ^17.0.0" from react-swipeable-views#0.14.0
npm ERR! node_modules/react-swipeable-views
npm ERR! react-swipeable-views#"*" 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/sam/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/sam/.npm/_logs/2022-08-04T16_50_51_600Z-debug-0.log
Everything was working just fine before the idea of moving to react 18.
Thanks react, now how do I fix this problem? I have tens of other dependencies which I'm unable to install because of this error, I was able to rescue the ones listed above in the package.json file, thank god.
If I wanted to roll back to react#17 I can't because there's no way you can do it since create-react-app does not have such an option, and if you npm un react and npm i react#17 the errors will remain because create-react-app installs other dependencies and not only react.
Any help to get out of this problem?
with explanation, why this is happening if possible 🌹.
npm ERR! peer react#"^15.3.0 || ^16.0.0 || ^17.0.0" from react-swipeable-views#0.14.0
That library doesn't support anything in 18 yet. According to the project github the issue was opened already this year.

Error Could not resolve dependency: redux-react-session

I need to install this package https://www.npmjs.com/package/redux-react-session
installing it with npm npm i redux-react-session shows this error:
PS C:\Users\michael\Desktop\login and signup\client> npm i redux-react-session
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client#0.1.0
npm ERR! Found: react#18.1.0
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#"^0.14.0 || ^15.0.0 || ^16.0.0" from redux-react-session#2.6.1
npm ERR! node_modules/redux-react-session
npm ERR! redux-react-session#"*" 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.
package.json:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#emotion/react": "^11.9.0",
"#emotion/styled": "^11.8.1",
"#mui/material": "^5.8.0",
"#mui/styled-engine-sc": "^5.8.0",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.2.0",
"#testing-library/user-event": "^13.5.0",
"antd": "^4.20.5",
"axios": "^0.27.2",
"formik": "^2.2.9",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-icons": "^4.4.0",
"react-loader-spinner": "^5.1.5",
"react-redux": "^8.0.2",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"styled-components": "^5.3.5",
"web-vitals": "^2.1.4",
"yup": "^0.32.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
when installing npm packages?
There are two solutions to resolve this issue. Let us look at each of those in detail.
Solution 1: Ignore the peerDependencies
The easiest way to fix the issue is to pass an additional parameter –legacy-peer-deps to npm install. The --legacy-peer-deps tells the npm to ignore the peer dependencies and continue the installation of the package.
Try the below command to install the dependencies for your project.
npm install --save --legacy-peer-deps
You can also set this permanently by adding this into a configuration by running the below command.
npm config set legacy-peer-deps true
Note: In this solution, the peer dependencies will not be installed by default, even if you are using the latest version of NPM.
Solution 2: Using –force
The other solution is to use the --force flag. The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk.
Step 1: Delete the current node_modules. You can remove it by using the below command.
rm -rf node_modules
Step 2: Remove the package-lock.json by running the below command
rm package-lock.json
Step 3: Clear the npm cache and perform the clean installation with --force flag as shown below.
npm cache clean --force
npm install --force
By performing the above steps, you should resolve the issue successfully.

Error resolving node dependency with example package

I'm currently using Node v16.14.0 and npm v8.3.1 on my local machine. We've been pushing commits to azure devops which runs a ci/cd pipeline with a step that does npm install and npm run build:x. Never had any problems until recently. The yml file for the azure pipeline specifies 16.x for Node:
steps:
- task: NodeTool#0
inputs:
versionSpec: "16.x"
displayName: "Install Node.js
- script: |
npm install
npm run build:ourenv
displayName: "npm install and build"
The other day I pushed a few lines of code and I noticed the task installed Node 16.15.0. But it built and deployed normally. Then the next day I made a change and noticed it installed Node 16.15.1. This broke the build that ran fine on my local machine.
The fix to get the build working in the pipeline was to change the node version to 16.15.0 (the last successful build). But I'd like to get it to work with 16.x again.
The output of the pipeline build shows a problem resolving at least one dependency (package.json hasn't changed). Here's the output:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: #typescript-eslint/eslint-plugin#5.16.0
npm WARN Found: #typescript-eslint/parser#4.31.0
npm WARN node_modules/#typescript-eslint/parser
npm WARN #typescript-eslint/parser#"^4.31.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer #typescript-eslint/parser#"^5.0.0" from #typescript-eslint/eslint-plugin#5.16.0
npm WARN node_modules/#typescript-eslint/eslint-plugin
npm WARN #typescript-eslint/eslint-plugin#"^5.5.0" from eslint-config-react-app#7.0.0
npm WARN node_modules/eslint-config-react-app
npm WARN 1 more (eslint-plugin-jest)
npm WARN
npm WARN Conflicting peer dependency: #typescript-eslint/parser#5.27.1
npm WARN node_modules/#typescript-eslint/parser
npm WARN peer #typescript-eslint/parser#"^5.0.0" from #typescript-eslint/eslint-plugin#5.16.0
npm WARN node_modules/#typescript-eslint/eslint-plugin
npm WARN #typescript-eslint/eslint-plugin#"^5.5.0" from eslint-config-react-app#7.0.0
npm WARN node_modules/eslint-config-react-app
npm WARN 1 more (eslint-plugin-jest)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #typescript-eslint/parser#4.31.0
npm ERR! Found: eslint#8.11.0
npm ERR! node_modules/eslint
npm ERR! peer eslint#"^7.5.0 || ^8.0.0" from #babel/eslint-parser#7.17.0
npm ERR! node_modules/#babel/eslint-parser
npm ERR! #babel/eslint-parser#"^7.16.3" from eslint-config-react-app#7.0.0
npm ERR! node_modules/eslint-config-react-app
npm ERR! eslint-config-react-app#"^7.0.0" from react-scripts#5.0.0
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"^5.0.0" from the root project
npm ERR! peer eslint#"^6.0.0 || ^7.0.0 || ^8.0.0" from #typescript-eslint/eslint-plugin#5.16.0
npm ERR! node_modules/#typescript-eslint/eslint-plugin
npm ERR! #typescript-eslint/eslint-plugin#"^5.5.0" from eslint-config-react-app#7.0.0
npm ERR! node_modules/eslint-config-react-app
npm ERR! eslint-config-react-app#"^7.0.0" from react-scripts#5.0.0
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"^5.0.0" from the root project
npm ERR! peerOptional #typescript-eslint/eslint-plugin#"^4.0.0 || ^5.0.0" from eslint-plugin-jest#25.7.0
npm ERR! node_modules/eslint-plugin-jest
npm ERR! eslint-plugin-jest#"^25.3.0" from eslint-config-react-app#7.0.0
npm ERR! node_modules/eslint-config-react-app
npm ERR! eslint-config-react-app#"^7.0.0" from react-scripts#5.0.0
npm ERR! node_modules/react-scripts
npm ERR! 16 more (#typescript-eslint/experimental-utils, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint#"^5.0.0 || ^6.0.0 || ^7.0.0" from #typescript-eslint/parser#4.31.0
npm ERR! node_modules/#typescript-eslint/parser
npm ERR! #typescript-eslint/parser#"^4.31.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint#7.32.0
npm ERR! node_modules/eslint
npm ERR! peer eslint#"^5.0.0 || ^6.0.0 || ^7.0.0" from #typescript-eslint/parser#4.31.0
npm ERR! node_modules/#typescript-eslint/parser
npm ERR! #typescript-eslint/parser#"^4.31.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.
And my package.json looks like this:
{
"name": "myapp",
"version": "1.0.0",
"private": true,
"dependencies": {
"#emotion/react": "^11.6.0",
"#emotion/styled": "^11.6.0",
"#material-ui/core": "^4.12.3",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.60",
"#mui/icons-material": "^5.2.4",
"#mui/lab": "^5.0.0-alpha.60",
"#mui/material": "^5.5.2",
"#mui/styled-engine-sc": "^5.5.2",
"#mui/styles": "^5.5.1",
"#mui/types": "^7.1.0",
"#mui/x-data-grid": "^5.7.0",
"#mui/x-date-pickers": "^5.0.0-alpha.2",
"#popperjs/core": "^2.10.1",
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^12.1.0",
"#testing-library/user-event": "^13.2.1",
"#types/history": "^4.7.9",
"#types/jest": "^27.0.1",
"#types/node": "^16.9.1",
"#types/react": "^17.0.20",
"#types/react-big-calendar": "^0.36.4",
"#types/react-dates": "^21.8.3",
"#types/react-dom": "^17.0.9",
"#types/react-router-dom": "^5.1.8",
"#types/reactstrap": "^8.7.1",
"#types/validator": "^13.7.1",
"#typescript-eslint/parser": "^4.31.0",
"array-move": "^4.0.0",
"axios": "^0.21.4",
"bootstrap": "^5.1.1",
"connected-react-router": "6.9.1",
"css-loader": "^6.2.0",
"date-fns": "^2.28.0",
"env-cmd": "^10.1.0",
"eslint-plugin-flowtype": "^5.9.2",
"eslint-plugin-import": "2.24.0",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-react": "7.24.0",
"history": "5.0.1",
"jquery": "^3.6.0",
"jshint": "^2.13.4",
"merge": "^2.1.1",
"moment": "^2.29.1",
"msal": "^1.4.12",
"oidc-react": "^1.5.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-big-calendar": "^0.39.4",
"react-dates": "^21.8.0",
"react-dom": "^17.0.2",
"react-draggable": "^4.4.4",
"react-localization": "^1.0.17",
"react-popper": "^2.2.5",
"react-query": "^3.23.2",
"react-quill": "^1.3.5",
"react-router": "^5.2.1",
"react-router-dom": "^6.0.2",
"react-scripts": "^5.0.0",
"react-sortable-hoc": "^2.0.0",
"reactstrap": "^8.10.0",
"styled-components": "^5.3.5",
"svgo": "^2.6.0",
"typescript": "^4.4.3",
"uuid": "^8.3.2",
"validator": "^13.7.0"
},
"scripts": {
"start:development": "env-cmd -f .env.development react-scripts start",
"start:staging": "env-cmd -f .env.staging react-scripts start",
"start:prod": "env-cmd -f .env.production react-scripts start",
"build:development": "env-cmd -f .env.development react-scripts build",
"build:staging": "env-cmd -f .env.staging react-scripts build",
"build:prod": "env-cmd -f .env.production react-scripts build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#types/uuid": "^8.3.4"
}
}
My package.json has a dep for #typescript-eslint/parser # v4.31.0. I ran npm list #typescript-eslint/parser and the output is:
myapp#0.1.0 D:\dev\repos\myapp
β”œβ”€β”€ #typescript-eslint/parser#4.31.0
└─┬ react-scripts#5.0.0
└─┬ eslint-config-react-app#7.0.0
β”œβ”€β”¬ #typescript-eslint/eslint-plugin#5.16.0
β”‚ └── #typescript-eslint/parser#4.31.0 deduped invalid: "^5.0.0" from node_modules/#typescript-eslint/eslint-plugin
└── #typescript-eslint/parser#5.16.0
It appears to me that a dep of one of my dep requires a version of #typescript-eslint/parser that isn't compatible with the version in my project. Is that correct? And if so, what do I do to fix it (what does fixing the conflict upstream mean here)? And does the solution involve only upgrading this package, or upgrading/downgrading node too? Why is this apparent incompatibility only an issue in 16.15.1 and not in 16.15.0?
For someone with more experience, can you tell by looking at my package.json file what's wrong?
Thanks for any input.

docker build vue3 not compatible with element-ui on node:16-buster-slim

dockerfile:
FROM node:16-buster-slim
RUN apt-get update
WORKDIR /app
COPY package.json /home
RUN npm install --prefix /home
package.json
{
"name": "test",
"version": "0.1.0",
"private": false,
"scripts": {
"dev": "vue-cli-service serve --mode development --host 0.0.0.0",
"serve": "vue-cli-service serve --mode production --host 0.0.0.0",
"build": "vue-cli-service build",
"jest": "vue-cli-service test:unit --watchAll",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.4",
"core-js": "^3.6.5",
"dateformat": "^5.0.2",
"element-plus": "^1.1.0-beta.9",
"element-ui": "^2.15.6",
"lib-flexible": "^0.3.2",
"ol": "^6.6.1",
"spark-md5": "^3.0.2",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
"vuelayers": "^0.11.36",
"vuex": "^4.0.0-0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-unit-jest": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"#vue/eslint-config-standard": "^5.1.2",
"#vue/test-utils": "^2.0.0-0",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0",
"fs-extra": "^10.0.0",
"lint-staged": "^9.5.0",
"mockjs": "^1.1.0",
"node-sass": "^4.14.1",
"px2rem-loader": "^0.1.9",
"sass-loader": "^8.0.2",
"typescript": "~3.9.3",
"vue-jest": "^5.0.0-0"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue}": [
"vue-cli-service lint",
"git add"
]
}
}
Step: RUN npm install --prefix /home
---> Running in fc08d7e933ed npm notice
npm notice New patch version of npm available! 8.1.0 -> 8.1.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.4
npm notice Run npm install -g npm#8.1.4 to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: artemis#0.1.0
npm ERR! Found: vue#3.2.22
npm ERR! node_modules/vue
npm ERR! vue#"^3.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^2.5.17" from element-ui#2.15.6
npm ERR! node_modules/element-ui
npm ERR! element-ui#"^2.15.6" 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 /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-11-25T01_40_08_953Z-debug.log
but this package.json work well on node:lts-alpine base image
It seems that you have problems with peer dependencies, if you just set your npm to use legacy dependency logic to install your packages you will solve the problem.
Just add to your Dockerfile this setting before running npm install:
...
COPY package.json /home
RUN npm config set legacy-peer-deps true
RUN npm install --prefix /home
To understand what this flag does I suggest you read this SO answer where it is explained extensively.

How do I resolve peer dependency error: The package react#15.3.2 does not satisfy its siblings' peerDependencies requirements

I am getting this error when I run npm install. This seems because I am unable to satisfy some peer dependency but I am unsure which peer dependency I need to fix.
Ξ» npm install
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package react#15.3.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer belle#2.0.7 wants react#>=0.14.0 || ^15.0.0-rc
npm ERR! peerinvalid Peer material-ui#0.15.4 wants react#^15.0.0
npm ERR! peerinvalid Peer react-infinite#0.9.2 wants react#^15.0.0
npm ERR! peerinvalid Peer react-input-field#1.2.4 wants react#>=0.12.0
npm ERR! peerinvalid Peer react-router#0.13.6 wants react#0.13.x || 0.14.x || ^15.0.1
npm ERR! peerinvalid Peer react-tap-event-plugin#0.2.2 wants react#^0.14.0
npm ERR! peerinvalid Peer react-toolbox#1.2.1 wants react#~0.14 || ~15.3.0
npm ERR! peerinvalid Peer react-addons-css-transition-group#15.3.2 wants react#^15.3.2
npm ERR! peerinvalid Peer react-dom#15.3.2 wants react#^15.3.2
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Daljeet\Documents\hive\client\npm-debug.log
I have also attached a copy of the package.json
dependencies:
"dependencies": {
"belle": "^2.0.7",
"body-parser": "^1.6.5",
"bootstrap": "^3.3.0",
"compression": "^1.0.11",
"config": "^1.21.0",
"config-js": "^1.1.9",
"connect-ensure-login": "^0.1.1",
"cors": "^2.4.1",
"dateformat": "^1.0.12",
"dotenv": "^0.4.0",
"errorhandler": "^1.1.1",
"express": "^4.8.5",
"express-jwt": "^0.3.1",
"flux": "^2.0.1",
"i": "^0.3.5",
"immutability-helper": "^2.0.0",
"jsonwebtoken": "^5.0.1",
"jwt-decode": "^1.1.0",
"keymirror": "^0.1.1",
"lodash": "4.0.0",
"log4js": "^0.6.38",
"material-ui": "~0.15.4",
"mongoose": "^4.3.4",
"morgan": "^1.2.3",
"normalize.css": "^4.2.0",
"pg": "^4.5.5",
"react": "15.3.2",
"react-infinite": "^0.9.2",
"react-input-field": "^1.2.4",
"react-mixin": "^1.1.0",
"react-router": "^0.13.2",
"react-star-rating": "^1.4.2",
"react-tap-event-plugin": "~0.2.2",
"react-toolbox": "^1.2.1",
"react-virtual-list": "^1.8.0",
"reqwest": "2.0.5",
"when": "^3.7.2"
},
"devDependencies": {
"babelify": "^6.1.0",
"browser-sync": "^2.1.6",
"browserify": "^8.0.3",
"clean-css": "^3.1.9",
"eslint": "^0.14.1",
"nodemon": "^1.5.0",
"rework": "^1.0.1",
"rework-npm": "^1.0.0",
"rework-npm-cli": "^0.1.1",
"serve": "^1.4.0",
"uglify-js": "^2.4.15",
"watchify": "^2.1.1"
}
}
it worked when I:
updated npm "npm install npm -g"
downgraded react to; "react": "15.3.0"
cleared cache: npm cache clear
removed node_modules, rm -rf node_modules,
reinstalled node_modules, npm install.
For me npm install --legacy-peer-deps worked. Please read about this flag before using it.
--legacy-peer-deps: ignore all peerDependencies when installing (in the style of npm version 4 through version 6).
Just update node package manager (npm) to the latest version.
npm install npm -g
I was facing the same issue and I used following things:
1. Update the react version: "react": ^16.2.0" in package.json file
2. Delete the node modules by rm -rf node_modules
3. Run npm install
4. npm update
This worked for me.
Use the following command to resolve this when installing the node module
npm install --legacy-peer-deps
if above doesn't work for you then you can tey npm install --force
--legacy-peer-deps: ignore all peerDependencies when installing, in the style of npm version 4 through version 6.

Resources