skip to Main Content

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: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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 ….

2

Answers


  1. For 1st problem:

    It’s package dependencies problem.
    It’s look like you use React 17 (Found: [email protected]). 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.

    Login or Signup to reply.
  2. 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:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search