React version mismatch when creating new projects #2055
Replies: 3 comments 1 reply
-
npm cache clean --force |
Beta Was this translation helpful? Give feedback.
-
Is the HMR fix inside this? |
Beta Was this translation helpful? Give feedback.
-
Edit: I wonder if I am being successful but the CLI is now confused #2133 I've had this issue for a while and tried many iterations to fix the peer dependency npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-reconciler@0.29.2 The thing that gets me the closest is npm cache clean --force
# delete node_modules and package-lock
npm install --legacy-peer-deps This seems to fix the dependency problems but then I am left with the fun warning
Deleting package-lock and running Any ideas of what else I can try to fix my dependency hell? |
Beta Was this translation helpful? Give feedback.
-
If you are getting an error like
Invalid hook call
or similar when runningnpm create @shopify/hydrogen/latest
, there is probably a React version mismatch in the CLI dependencies.This is something that should be fix in Hydrogen and Shopify CLI but, in the meantime, you can try doing one of the following:
npm create @shopify/hydrogen@latest --legacy-peer-deps --cache ~/randomDir
This avoids installing peer dependencies, thus reducing the chance of getting multiple versions of React. Provide a random cache directory to avoid reusing preinstalled CLI versions in your global cache that don't use
--legacy-peer-deps
. Alternatively, you can runnpm cache clean --force
before installing it instead.Once the project is created, ensure your React dependencies
react
andreact-dom
are pinned to18.2.0
before runningnpm run dev
.Beta Was this translation helpful? Give feedback.
All reactions