Closed pneedham-mdsol closed 3 years ago
Similar problem here with emotion.sh
you likely need to link React or styled-components to a single source. What I mean is say you have a lib that contains React or styled-components then your project does as well. This will cause a problem with some libs as you can only have once instance of them. React is this way.
To resolve cd into the instance of React (or other applicable lib)
cd node_modules/some_module
yarn link
next go to the third party lib and link to that instance.
yarn link some_module
That should resolve the issue. Let me know if that helps as I believe that is your issue!
Closing. Solution by @blujedis should fix the problem. Please re-open issue persists.
Hi @HarveyD , I've run into an issue when on the
styled-components
branch of this repo: After switching to that branch, runningnpm install
andnpm build
, I created a newcreate-react-app
project, ranyarn add file:../../react-component-library/
, added theTestComponent
to the defaultApp.js
file, and after runningyarn start
, it leads to the error page with this text:npm ls react
in the CRA project yields only one result,react@17.0.1
, same forreact-dom
. However,npm ls styled-components
gives back:I believe this is caused by
styled-components
existing both as a dev and peer dependency. When attempting to build a similar component library, but withoutstyled-components
as a devDependency, that leads to storybook being unable to start.Any ideas how this branch can both support Storybook as well as avoid the React mismatching versions error?
For context, I'm using create-react-app 4.0.1, yarn 1.22.5, node 12.19.0, and npm 6.14.8 on macOS.