React version conflict stoping me from installing jtest or other library

Hi, anyone has encountered this issue and could you give me some suggestion? Or is there any way to uninstall and reinstall them to resolve this issue?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @atlaskit/icon@22.0.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.11.3
npm ERR!   node_modules/@emotion/react
npm ERR!     @emotion/react@"^11.7.1" from @atlaskit/icon@22.0.0
npm ERR!     node_modules/@atlaskit/icon
npm ERR!       @atlaskit/icon@"^22.0.0" from the root project
npm ERR!   peer react@">=16.8.0" from @emotion/use-insertion-effect-with-fallbacks@1.0.1
npm ERR!   node_modules/@emotion/use-insertion-effect-with-fallbacks
npm ERR!     @emotion/use-insertion-effect-with-fallbacks@"^1.0.1" from @emotion/react@11.11.3
npm ERR!     node_modules/@emotion/react
npm ERR!       @emotion/react@"^11.7.1" from @atlaskit/icon@22.0.0
npm ERR!       node_modules/@atlaskit/icon
npm ERR!         @atlaskit/icon@"^22.0.0" from the root project
npm ERR!   5 more (@forge/react, react-reconciler, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from @atlaskit/icon@22.0.0
npm ERR! node_modules/@atlaskit/icon
npm ERR!   @atlaskit/icon@"^22.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from @atlaskit/icon@22.0.0
npm ERR!   node_modules/@atlaskit/icon
npm ERR!     @atlaskit/icon@"^22.0.0" from the root project
npm ERR!

Thanks,
Craig

Have you tried npm install --legacy-peer-deps or npm install --force --legacy-peer-deps?

Unfortunately Atlaskit is still not compatible with React 18, if you’re lucky and you’re not doing anything too advanced it might still work, but in general if you want to use it you should stick to React 16.

1 Like

We’ve run into this as well when installing Storybook. It’s quite frustrating.

Our workaround is to specify overrides in package.json like:

"overrides": {
    "react": "$react",
    "react-dom": "$react-dom"
  }

It might be worth giving this approach a spin.

1 Like