Repository navigation
Conversation
|
Hi @benwis, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
|
Thank you for signing the Contributor License Agreement. Let's get this merged! π₯³ |
|
Hey Ben! Just to clarify - are you getting 2 versions of |
|
@brophdawg11 Hey Matt, This is the error I get: Unexpected Server Error
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.Looks like the culprit is react-router-dom, as all the other deps on react for the remix packages were >16 and not tied to a specific release.So I ended up with both v18 that I defined in my package.json and v17 for all the remix react deps. npm ls react
remix-rust@0.0.1 /Users/benwis/Documents/air-metal-stack
βββ¬ remix-air-metal@ -> ./packages/remix-app
βββ¬ @remix-run/deno@1.5.1
β βββ¬ @remix-run/server-runtime@1.5.1
β βββ react@17.0.2 deduped
βββ¬ @remix-run/react@1.5.1
β βββ¬ react-dom@17.0.2
β β βββ react@17.0.2 deduped
β βββ¬ react-router-dom@6.3.0
β β βββ¬ react-router@6.3.0
β β β βββ react@17.0.2 deduped
β β βββ react@17.0.2 deduped
β βββ react@17.0.2
βββ¬ react-dom@18.1.0
β βββ react@18.1.0 deduped
βββ react@18.1.0I've pushed a working version to the react-18 branch of this repo, I just had to override all the react dependencies listed above. If you want to see the error, feel free to go back 1 commit in the react-18 branch Not sure if the best approach here is to change the react dependencies to be 18 or just be > 16 or > 17, I'll leave that to the team. |
|
Thanks for the reproduction - the thing that's got me confused is why changing |
|
@brophdawg11 Oof, this is what I get when I submit PRs before coffee. I also needed to update the main react deps, and I have done so now |
|
haha, an all too common mistake! I'm trying to get your stack running locally on an M1 MBP but getting the following on rust installation step 2: > curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack-init: no precompiled binaries available for CPU architecture: arm64Any insights on building on an M1? I'm also curious if this double-dependency thing is deno-related - any idea if it's reproducible in a non-rust world using deno? |
|
So far this is the only thing I have tried Deno with, but the build step doesn't use rust at all, so probably? I did not notice this error updating the blues stack to react 18 though, but that's node only. I usually develop on an M1 Macbook Pro, you want to run |
|
ok - I got back around to playing with this locally today (thanks for the tip on On my very first install today I had a mismatch but that was with the version of this repo I cloned last week and it had a local Today I tried cloning and installing fresh (without a # A fresh install on main gave me properly deduped 17.0.2 packages
> git clone git@github.com:benwis/air-metal-stack.git
> cd air-metal-stack
> npm install
> npm ls react-dom
air-metal-stacl@0.0.1 ./air-metal-stack
βββ¬ remix-air-metal@ -> ./packages/remix-app
βββ¬ @remix-run/deno@1.5.1
β βββ¬ @remix-run/server-runtime@1.5.1
β βββ react-dom@17.0.2 deduped
βββ¬ @remix-run/react@1.5.1
β βββ react-dom@17.0.2 deduped
β βββ¬ react-router-dom@6.3.0
β βββ react-dom@17.0.2 deduped
βββ react-dom@17.0.2
# Then I did a fresh install on the react-18 branch and got properly deduped versions there
> git checkout react-18
> rm -rf node_modules/
> rm -f package-lock.json
> npm install
> npm ls react-dom
remix-rust@0.0.1 /Users/matt/me/remix/repos/playgrounds/air-metal-stack2
βββ¬ remix-air-metal@ -> ./packages/remix-app
βββ¬ @remix-run/deno@1.5.1
β βββ¬ @remix-run/server-runtime@1.5.1
β βββ react-dom@18.1.0 deduped
βββ¬ @remix-run/react@1.5.1
β βββ react-dom@18.1.0 deduped
β βββ¬ react-router-dom@6.3.0
β βββ react-dom@18.1.0 deduped
βββ react-dom@18.1.0The dependencies you're updating in this PR are the monorepo deps for local development in I also tried creating a new app using Do you want to try this fresh and see if you're still hitting the issue? See if you can find any specific steps that get you into this scenario? |
|
Really appreciate the second pair of eyes on this. You are quite correct, once I deleted package-lock.json and reinstalled everything, all the React dependencies correctly parsed. God npm frustrates me sometimes. I am closing this, as it appears to not be an issue. |
Co-authored-by: Matt Brophy <matt@brophy.org>
Issue
react-router and react-router-dom's fixed react and react-dom dependencies are causing multiple versions of react and react-dom to be bundled in my remix app.
Fix
Update package.json to version 18.1. Alternatively this could be changed to be >16 like the other Remix packages I can confirm that this fixes it in my Remix stack.