Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: cli-kit React dependency version mismatch #3800

Closed
2 tasks done
nboliver-ventureweb opened this issue Apr 26, 2024 · 6 comments
Closed
2 tasks done

[Bug]: cli-kit React dependency version mismatch #3800

nboliver-ventureweb opened this issue Apr 26, 2024 · 6 comments
Labels
Type: Bug Something isn't working

Comments

@nboliver-ventureweb
Copy link

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

cli-kit and its deps should have matching React versions

Actual behavior

cli-kit has React pinned at v18.2.0
ink has it listed as ^18.0.0
This is causing ink to install v18.3.0 and cli-kit to install 18.2.0

image

Verbose output

n/a

Reproduction steps

  1. Install @shopify/cli-kit
  2. Run npm list react
  3. See different React versions
  4. Run a command and get the You might have more than one copy of React in the same app error

Operating System

Mac OS

Shopify CLI version (check your project's package.json if you're not sure)

3.59.1

Shell

No response

Node version (run node -v if you're not sure)

No response

What language and version are you using in your application?

No response

@nboliver-ventureweb nboliver-ventureweb added the Type: Bug Something isn't working label Apr 26, 2024
@imrostom
Copy link

imrostom commented Apr 28, 2024

I also face this issue, how solved this issue ?

@isaacroldan
Copy link
Contributor

Hi @nboliver-ventureweb @imrostom, is having 2 versions of react affecting your project?

Do you have Shopify CLI installed globally in your system?

@nboliver-ventureweb
Copy link
Author

Yes having two versions is affecting the project. I have used overrides in package.json to fix it for now.
I have Shopify CLI installed globally with Homebrew, but this project is using Shopify CLI installed local to the project to ensure everyone is on the same version. Commands are being run with npx.

@michenly
Copy link

michenly commented Apr 29, 2024

Related issue for using npm create @shopify/hydrogen@latest

When creating Hydrogen project, react version 18.3.1 is install (we use "react": "^18.2.0").
However, @shopify/cli-kit is pinning to react version 18.2.0

This create a react version miss-match and the create script gets error out with "Warning: Invalid hook call" error.


The new react version released 3 days ago likely cause all the issues to come out suddenly.

Screenshot 2024-04-29 at 6 53 31 PM

@frandiox
Copy link
Contributor

So a simple installation using cli-kit results in the following tree:

react@18.2.0
node_modules/@shopify/cli-kit/node_modules/react
  react@"18.2.0" from @shopify/cli-kit@3.58.0
  ...
react@18.3.1 peer
node_modules/react
  peer react@">=18.0.0" from ink@4.4.1
  node_modules/ink
    ink@"4.4.1" from @shopify/cli-kit@3.58.0
    ...

This is even independent of what other packages like Hydrogen might require. cli-kit installs 18.2.0 and its dependency ink installs 18.3.1.

Therefore, I think we need a patch release changing cli-kit to ^18.2.0 or ^18.0.0 like ink requires?

@michenly
Copy link

michenly commented Apr 30, 2024

Fixed by #3813 with @shopify/cli@3.59.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants