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

Peer dependency issue between Create-React-App and Storybook #6344

Closed
VincentLanglet opened this issue Feb 5, 2019 · 12 comments
Closed

Peer dependency issue between Create-React-App and Storybook #6344

VincentLanglet opened this issue Feb 5, 2019 · 12 comments

Comments

@VincentLanglet
Copy link

I previously asked a question about the warning about unmeet peer dependency here: #6134
I had the answer these are just warnings and nothing to worry about.

Unfortunately now I have errors:
When I install "@storybook/react" and run "storybook": "start-storybook -p 9009 -s public",
I get Error: Cannot find module 'babel-loader/package.json' from ...

But if I install babel-loader, and run "start": "react-scripts start", I get

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "babel-loader": "8.0.4"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:

Of course, it's fixable if I install the exact version "8.0.4". Like explains here storybookjs/storybook#5183
But shouldn't create-react-app re-think about the way dependencies are used ?

I don't know a lot about how it works. But why react-script version can't use his dependencies version and let other dependencies to use their ?

@mrmckeb
Copy link
Contributor

mrmckeb commented Feb 6, 2019

Hi @VincentLanglet, this has been reported before as you mentioned.

I'm currently working on a PR with Storybook to resolve this properly.
storybookjs/storybook#5308

@VincentLanglet
Copy link
Author

VincentLanglet commented Feb 6, 2019

@mrmckeb Yes i saw that, a big thanks to you for working on it.

But I still wonder why it's not possible for react-script to use her own version of babel-loader and @storybook/react to use her own version of babel-loader too ?
The same could be done for others dependencies like jest or eslint.

For example, in my package.lock I have two qs version which cohabit together.

qs@6.5.2, qs@~6.5.1, qs@~6.5.2:
  version "6.5.2"
  ...

qs@^6.5.1, qs@^6.6.0:
  version "6.6.0"
  ...

Why is it different with react-script dependencies ?
(And not every dependencies, I have different @babel/core versions for example)

@gcallaghan
Copy link

gcallaghan commented Feb 12, 2019

I don't have storybook installed and I see this error as well. It seems there is a strict match for both babel-preset-react-app and react-scripts

$ npm ls babel-loader
my-package@0.1.0 /Users/gcallaghan/work/my-package
└─┬ react-scripts@2.1.3
  ├── babel-loader@8.0.4
  └─┬ babel-preset-react-app@7.0.1
    └── babel-loader@8.0.5

@mrmckeb mrmckeb self-assigned this Feb 13, 2019
@mrmckeb
Copy link
Contributor

mrmckeb commented Feb 13, 2019

Hi @gcallaghan, that's odd, thanks for raising. Those projects should definitely be aligned, and realistically, we could resolve babel-loader from babel-preset-react-app... Would you be interested in raising a PR to look into that?

@VincentLanglet
Copy link
Author

@gcallaghan your react-scripts is not up to date.
The 2.1.5 version use babel-loader@8.0.5.

@gcallaghan
Copy link

I'll run yarn upgrade on my react-scripts now and see if that fixes it.

@stale
Copy link

stale bot commented Mar 15, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@markcellus
Copy link

@gcallaghan did upgrading your react-scripts solve the issue? I'm having this same problem.

@gcallaghan
Copy link

@mkay581 At the time yes, but my understanding is type of issue with CRA happens from time to time due to transitive dependencies. Unfortunately I don't have the github issue or thread handy.

@mrmckeb
Copy link
Contributor

mrmckeb commented Jun 20, 2019

Hi there, newer releases of Storybook will use your babel-loader from Create React App. So, you can just remove it from your package.json.

Let us know if you have any other issues!

@mrmckeb mrmckeb closed this as completed Jun 20, 2019
@markcellus
Copy link

markcellus commented Jun 20, 2019

Thanks! can you add a link to the discussion thread? Or link to the Storybook PR that fixes it? I'm curious to know what the fix is and when it will be available.

@mrmckeb
Copy link
Contributor

mrmckeb commented Jun 23, 2019

@mkay581, I fixed this over at Storybook itself - take a look at the preset for create-react-app if you're interested. There's a bit happening there.

@lock lock bot locked and limited conversation to collaborators Jun 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants