MISMATCHING VERSIONS OF REACT.

This happends for many reasons but one very common is when you're creating UI components library or packages for npm which was my case.

I was updating my package for animations animate-styled adding Ts support, but in the past I was using nwb like a webpack because this tool allows me to see at the same time how works my package in local environment and that is good for me, but sadly nowdays they have no support for Ts.

animate-styled in action

I found many ways to solve this problem even I tried some of them because I didn't want to upload my package to npm before testing everything was working fine.

  • One of the solution is with resolutions for yarn
  "resolutions": {
    "react": "17.0.1",
    "react-dom": "17.0.1",
  },
  ...
  • You can find anothers like yarn link

But with this simple command you can resolve this series of conflicts assuming that myTestApp and mylib are sister folders. go to mylib and run in terminal.

 npm link ../myTestApp/node_modules/react

And that's it.