0

I was trying npm install i got the error as -

# npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: isomorphic@4.0.2
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   dev react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0-0" from enzyme-adapter-react-16@1.15.6
npm ERR! node_modules/enzyme-adapter-react-16
npm ERR!   enzyme-adapter-react-16@"^1.15.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.

I tried using npm install --force and npm install --legacy--peer-deps then got the error as -

# npm install --force
npm WARN using --force Recommended protections disabled.
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

also tried changing max min timeout ... but didnt work when search on google i found some yarn cmd , but am not sure what yarn does .. can anyone please help me out ....

Lin Du
  • 88,126
  • 95
  • 281
  • 483
vaishnavi
  • 25
  • 6

2 Answers2

0

For 1st problem:

It's package dependencies problem. It's look like you use React 17 (Found: react@17.0.2). But module enzyme-adapter-react-16 need React 16.

Solution: downgrade react to version 16 or change enzyme-adapter-react-16 to enzyme-adapter-react-17.

A1exandr
  • 26
  • 2
  • now getting - # npm update npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: isomorphic@4.0.2 npm ERR! Found: antd@4.24.12 npm ERR! node_modules/antd npm ERR! antd@"^4.16.12" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer antd@"^5.0.1" from @ant-design/compatible@5.1.1 npm ERR! node_modules/@ant-design/compatible npm ERR! @ant-design/compatible@"^5.1.1" from the root project – vaishnavi Jul 03 '23 at 05:54
  • It's looks like you have dependencies problem with antd: isomorphic@4.0.2 required antd version 4, but installed antd@5 – A1exandr Jul 04 '23 at 05:53
0

From the enzyme-adapter-react-16 documentation, we know:

At the moment, Enzyme has adapters that provide compatibility with React 16.x, React 15.x, React 0.14.x and React 0.13.x.

Enzyme Adapter Package React semver compatibility
enzyme-adapter-react-16 ^16.4.0-0

But the react version is ^17.0.2 in your project, which is an incompatible version.

Two solutions:

Unfounaly, there is no official adapter for React 17.x and React 18.x

Further reading:

Lin Du
  • 88,126
  • 95
  • 281
  • 483