question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI - create-react-library - 5.1 regression

See original GitHub issue

Describe the bug

Running storybook init (npx -p @storybook/cli@next sb init) on a project generated with create-react-library with next storybook version results with an error:

 • Adding storybook support to your "Create React App" based project                                                            
     TypeError: Cannot read property 'split' of undefined                                                                       
    at new Range (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/node_modules/semver/semver.js:866:20)
    at outside (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/node_modules/semver/semver.js:1408:11)
    at Function.gtr (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/node_modules/semver/semver.js:1402:10)
    at gtr (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/generators/REACT_SCRIPTS/index.js:42:14)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

Difference between what generates create-react-app and create-react-library is where it puts react-scripts dependency. create-react-app puts it in dependencies while create-react-library puts it in devDependencies. It works if I move react-scripts dependency from devDependencies to dependenciesafter generating project with create-react-library.

It also works correctly with 5.0.11: npx -p @storybook/cli sb init.

To Reproduce Steps to reproduce the behavior:

  1. npm install -g create-react-library
  2. create-react-library -s -t default test
  3. cd test
  4. npx -p @storybook/cli@next sb init

Expected behavior It should work the same way as npx -p @storybook/cli sb init - without an error, generating files.

System:

  • OS: Linux (Arch Linux)
  • Device: Thinkpad P50
  • Framework: React
  • Version: v5.1.0-beta.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
MikaelCarpentercommented, May 17, 2019

This seems like a simple fix, i’ll take this one for you @mrmckeb . PR incoming

1reaction
shilmancommented, May 21, 2019

Jeepers creepers!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-rc.0 containing PR #6815 that references this issue. Upgrade today to try it out!

Because it’s a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there’s still more to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

create-react-library - npm
CLI for easily bootstrapping modern react libraries. Latest version: 3.1.1, last published: 3 years ago. Start using create-react-library in ...
Read more >
GitHub - transitive-bullshit/create-react-library
Here's an article I wrote in April 2022 which should help you decide between these different tools. create-react-library. CLI for creating reusable, modern ......
Read more >
Create a component library using Create React App ... - Fathom
Let's create a reusable UI library that can be shared across multiple projects. React components are perfect for this.
Read more >
Unable to resolve dependency tree Reactjs - Stack Overflow
So it needs that version of react to function properly. On your tinder-clone@0.1.0 application you currently have react@17.0.1 . This problem ...
Read more >
How to Create and Publish a React Component Library
This tutorial will take you through the process of creating and publishing your own custom React component library and hosting it on Github....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found