“more than one copy of React” error when running locally
rijk opened this issue · comments
Hi, I am trying to clone this package to create some PRs. But when I run it (after building), I keep getting this Next JS error:
I've asked the question on the Next forums as well, but maybe you know a way to work around this?
@rijk I just ran into this on another project, the solution was the suggestion from the React docs at the bottom of this section: https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
Assuming
myapp
andmylib
are sibling folders, one possible fix is to runnpm link ../myapp/node_modules/react
frommylib
. This should make the library use the application’s React copy.
I think that's how I resolved this error with scroller-motion too, just comment if it doesn't do the trick 👌
Amazing. I would have never thought of that, but it worked! 👏 Next time I'll remember to check the React docs, haha.
PRs incoming 👾