Skip to content

React version mismatch when creating new projects #2055

Answered by NzakiCodes
frandiox asked this question in Help
Discussion options

You must be logged in to vote

If you are getting an error like Invalid hook call or similar when running npm 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 run npm clean cache --force before installing it inst…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by michenly
Comment options

You must be logged in to vote
1 reply
@frandiox
Comment options

frandiox May 1, 2024
Maintainer Author

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants