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.
Related
I am trying to deploy my next.js project, but I keep getting the following error with everything I do:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: rcd_drone#0.1.0
npm ERR! Found: #sanity/client#3.4.1
npm ERR! node_modules/#sanity/client
npm ERR! #sanity/client#"^3.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #sanity/client#"^2.11.0" from next-sanity-image#3.2.1
npm ERR! node_modules/next-sanity-image
npm ERR! next-sanity-image#"^3.2.1" 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 also have the following dependencies:
{
"name": "rcd_drone",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#babel/core": "^7.17.9",
"#sanity/client": "^3.2.0",
"#sanity/image-url": "^1.0.1",
"#stripe/stripe-js": "^1.25.0",
"canvas-confetti": "^1.5.1",
"next": "^12.1.0",
"next-sanity-image": "^3.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hot-toast": "^2.2.0",
"react-icons": "^4.3.1",
"frontmatter-markdown-loader": "^3.6.3",
"stripe": "^8.209.0"
},
"devDependencies": {
"#babel/preset-react": "^7.16.7",
"eslint": "8.13.0",
"eslint-config-next": "12.1.4"
}
}
Try doing the npm install --legacy-peer-deps within the Vercel project deploy page.
When deploying your project, go to the "build and output" settings, then in the npm command input write: npm install --legacy-peer-deps.
Select the override radio button, then try deploying.
Try deleting node_modules folder and package-lock.json file and run:
npm install --legacy-peer-deps
This is going to make fresh installation of the modules.
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.
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.
When running the react app I got this error in console - SharedArrayBuffer will require cross-origin isolation as of M91, around May 2021. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details.
Based on StackOverflow's suggestions I tried updating react version. I had version 16 and switched to 17. But now there are conflicts in the dependency tree. When I try to npm install this is the error I'm getting:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.2" from the root project
npm ERR! peer react#">=16.8.0" from #emotion/react#11.1.5
npm ERR! node_modules/#emotion/react
npm ERR! #emotion/react#"^11.1.1" from react-select#4.3.0
npm ERR! node_modules/react-select
npm ERR! react-select#"^4.2.1" from the root project
npm ERR! 17 more (#material-ui/core, #material-ui/lab, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^0.14 || ^15.0.0 || ^16.0.0-alpha" from airbnb-prop-types#2.160
npm ERR! node_modules/airbnb-prop-types
npm ERR! airbnb-prop-types#"^2.16.0" from enzyme-adapter-utils#1.14.0
npm ERR! node_modules/enzyme-adapter-utils
npm ERR! enzyme-adapter-utils#"^1.14.0" from enzyme-adapter-react-16#1.15.6
npm ERR! node_modules/enzyme-adapter-react-16
npm ERR! dev enzyme-adapter-react-16#"^1.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 C:\Users\USER\AppData\Local\npm-cache\eresolve-report.txt for a full rport.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Local\npm-cache\_logs\2021-04-25T15_17_39_361Z-dbug.log
package.json :
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"#material-ui/core": "^4.11.3",
"#material-ui/lab": "^4.0.0-alpha.57",
"#testing-library/jest-dom": "^5.11.9",
"#testing-library/react": "^11.2.5",
"#testing-library/user-event": "^12.8.3",
"aos": "^2.3.4",
"react": "^17.0.2",
"react-dom": "^17.0.1",
"react-icons": "^4.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-select": "^4.2.1",
"react-spring": "^8.0.27",
"styled-components": "^5.2.1",
"web-vitals": "^1.1.0"
},
"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"
]
},
"devDependencies": {
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"jest": "^26.6.0",
"react-dev-utils": "^11.0.4"
},
"proxy": "http://localhost:8080"
}
As I understand the error occurs because of the version of the enzyme. I tried upgrading it to version 17, but react doesn't let me do it and I get the above-given error.
What could be the solution to resolve the dependency conflicts?
I had the same issue, so I've installed the dependencies with yarn. and it worked like magic.
If you have React version 17, you can use this unofficial adapter for React 17 for enzyme.
import { configure } from 'enzyme';
import Adapter from '#wojtekmaj/enzyme-adapter-react-17';
configure({ adapter: new Adapter() });
Your package.json file contains the declaration of which version of React you're using. As long as your project is has all it needs from the version of React that enzyme-adapter-react-16 requires - which is ^16.4.0-0 according to Justin Mitchell - you can use that.
"dependencies": {
...
"react": "^16.4.0-0",
"react-dom": "^16.4.0-0",
...
}
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.