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

sh: start-storybook: command not found after upgrading to latest release #18923

Closed
zackhamin opened this issue Aug 12, 2022 · 17 comments
Closed

Comments

@zackhamin
Copy link

Describe the bug
I upgraded our version of Storybook in our React project to the latest version ^6.5
Afterwards I have the following issue when trying to run Storybook - sh: start-storybook: command not found
Using a Macbook.

Then upgraded to pre-release to see if it resolved.

To Reproduce
Upgrade Storybook and try to run it.

System
Environment Info:

System:
OS: macOS 12.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
npm: 8.17.0 - ~/Desktop/customer_contact_work/cc-component-library/node_modules/.bin/npm
Browsers:
Chrome: 104.0.5112.79
Safari: 15.2
npmPackages:
@storybook/addon-actions: ^7.0.0-alpha.18 => 7.0.0-alpha.19
@storybook/addon-essentials: ^7.0.0-alpha.18 => 7.0.0-alpha.19
@storybook/addon-links: ^7.0.0-alpha.18 => 7.0.0-alpha.19
@storybook/builder-webpack5: ^7.0.0-alpha.18 => 7.0.0-alpha.19
@storybook/cli: ^6.5.10 => 6.5.10
@storybook/manager-webpack5: ^7.0.0-alpha.10 => 7.0.0-alpha.10
@storybook/react: ^7.0.0-alpha.18 => 7.0.0-alpha.19
Additional context
Add any other context about the problem here.

@zackhamin
Copy link
Author

I should also add, I have tried to remove node_modules and re-install etc etc.

@coopbri
Copy link

coopbri commented Aug 14, 2022

I had this issue too, and discovered in the v7 release notes that start-storybook and build-storybook were removed. Here's the PR and a similar discussion here: #18675

I had to install @storybook/cli (make sure the version is the same as the Storybook core you are using, e.g. 7.0.0-alpha.19 based on your listed env info) and then sb dev worked!

@brianfoody
Copy link

If you have upgraded to storybook 7 and found yourself here then the problem is start-storybook is removed and the migration doesn't modify for some reason.

To fix modify your scripts to;

"storybook": "sb dev",
"build-storybook": "sb build"

Also check out the migration guide - https://github.com/storybookjs/storybook/blob/4a532ec8d8922ddf6b7a7e1cc68d88b35377b0a6/MIGRATION.md#start-storybook--build-storybook-binaries-removed

I was missing some things

@zackhamin
Copy link
Author

I had this issue too, and discovered in the v7 release notes that start-storybook and build-storybook were removed. Here's the PR and a similar discussion here: #18675

I had to install @storybook/cli (make sure the version is the same as the Storybook core you are using, e.g. 7.0.0-alpha.19 based on your listed env info) and then sb dev worked!

Brilliant, I have some run time errors- however this has helped a lot!

@zackhamin
Copy link
Author

If you have upgraded to storybook 7 and found yourself here then the problem is start-storybook is removed and the migration doesn't modify for some reason.

To fix modify your scripts to;

"storybook": "sb dev",
"build-storybook": "sb build"

Also check out the migration guide - https://github.com/storybookjs/storybook/blob/4a532ec8d8922ddf6b7a7e1cc68d88b35377b0a6/MIGRATION.md#start-storybook--build-storybook-binaries-removed

I was missing some things

Awesome! Thanks, having a read through and it helped loads.

Thanks again, Brian.

@coopbri
Copy link

coopbri commented Aug 22, 2022

I had this issue too, and discovered in the v7 release notes that start-storybook and build-storybook were removed. Here's the PR and a similar discussion here: #18675
I had to install @storybook/cli (make sure the version is the same as the Storybook core you are using, e.g. 7.0.0-alpha.19 based on your listed env info) and then sb dev worked!

Brilliant, I have some run time errors- however this has helped a lot!

Awesome! Happy to help with the runtime errors if you are still stuck, feel free to reach out.

@zackhamin
Copy link
Author

I had this issue too, and discovered in the v7 release notes that start-storybook and build-storybook were removed. Here's the PR and a similar discussion here: #18675
I had to install @storybook/cli (make sure the version is the same as the Storybook core you are using, e.g. 7.0.0-alpha.19 based on your listed env info) and then sb dev worked!

Brilliant, I have some run time errors- however this has helped a lot!

Awesome! Happy to help with the runtime errors if you are still stuck, feel free to reach out.

I am going to swiftly take you up on that offer.

we are using TSX in our app and it seems to have some conflicting issues with the upgrade. The new script runs fine and begins to build.

Screenshot 2022-08-22 at 10 40 59

Run time errors
Screenshot 2022-08-22 at 10 41 53

@JonathanKolnik
Copy link
Contributor

@zackhamin check out this https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-type-change-to-storyfn-and-the-new-story-type-now-refers-to-storyobj

I think you need to go from

export const MyStory: Story = () => <div />;

to

export const MyStory: StoryFn = () => <div />;

note the StoryFn

@EightArmCode
Copy link

EightArmCode commented Feb 11, 2023

This sorted me out. caveat: I did blindly accept all the changes

npx sb@next automigrate

@shilman
Copy link
Member

shilman commented Feb 13, 2023

Closing this. Please follow the migration instructions to upgrade: https://storybook.js.org/migration-guides/7.0

@Abeinevincent
Copy link

Run npx storybook@next automigrate and follow the prompts because youre using a newer version of storybook where start storybook and build storybook have been removed

@amerllica
Copy link

amerllica commented Apr 13, 2023

Run npx storybook@next automigrate and follow the prompts because youre using a newer version of storybook where start storybook and build storybook have been removed

Thanks @Abeinevincent . it helped me a lot

@MahmonirB
Copy link

Thanks @Abeinevincent, It works well.

@Abeinevincent
Copy link

Youre welcome

@andrewmelnyk
Copy link

I tried following the migration guide and when I run that upgrade command and the result is:

Need to install the following packages:
  storybook@7.0.12
Ok to proceed? (y) y
make: *** [upgrade] Error 1

@vicentematus
Copy link

Check if that your storybooks versions are the same on the package.json. The error happened to me because we were using Storybook@7 on some packages and Storybook@6 on other ones. Leading to the binary missing.

@helloint
Copy link

helloint commented Aug 7, 2024

I met this same issue and now I figured it out what happens.
If you upgrade to storybook@7 via command:

npx storybook@7 upgrade

The auto migration will handle this:
image
image
The migration will install storybook (Looks like it is actually same as @storybook/cli just have better name?) which includes binary storybook and sb. The migration will also help to auto update the npm scripts in packages.json
So if in some case you have skipped that step (maybe you upgrade storybook via just upgrading storybook related packages), then just manually install npm i storybook -D or yarn add storybook -D and update the npm scripts from:

    "storybook": "start-storybook -p 6006",
    "buildStorybook": "build-storybook",

to:

    "storybook": "storybook dev -p 6006",
    "buildStorybook": "storybook build",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests