Error running storybook - sh: 1: start-storybook: not found
Asked Answered
M

10

27

I am facing error running storybook.... even on a clean installation.

 npm run storybook

> @ storybook /media/programmersedge/New_Volume/devs/demostorybook
> start-storybook -p 9001 -c .storybook

sh: 1: start-storybook: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ storybook: `start-storybook -p 9001 -c .storybook`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @ storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I am using the latest storybook version. and my node version is 6.11.1 and npm version is 5.5.1

I also tried installing storybook with yarn but I am facing the same problem yarn version 1.3.2

Modestine answered 24/1, 2018 at 8:34 Comment(2)
please check your pakage.json file and update your script run command. hope it's worked for you.Malagasy
Have you tried installing dependencies first? This maybe a cause due to the absence of node_modulesSextuplicate
L
18

In most cases, you need to manually install @storybook/cli by running

# For npm
npm i -D @storybook/cli

# For yarn
yarn add -D @storybook/cli
Lloyd answered 11/10, 2020 at 13:3 Comment(0)
J
12

Update start and build scripts

"storybook": "sb dev",
"build-storybook": "sb build"
Jailbird answered 17/4, 2023 at 20:59 Comment(1)
THIS is the only answer that actually got me past the command not found for version 7 (7.5.1). The fact official docs rely on a template you might not want in your existing project is... distressing.Douty
A
9

Storybook v7

If you are facing this issue with Storybook 7, note that start-storybook and build-storybook were removed on 7.0.0-alpha.0 (June 7, 2022).

You should now use storybook dev or storybook build

Aetolia answered 4/7, 2023 at 14:56 Comment(0)
R
8

This error is due to the node_modules folder. If you delete that folder and run npm install. it will work. Mostly due to cropped dependency linking If you have configured a react app by yourself then the storyboard may need some other configuration. If you use create-react-app or react-npm-package-developer for React then it should work

Rowlett answered 24/1, 2018 at 10:37 Comment(1)
I have already tried that. And as I have already mentioned ... I have also tried a clean install of react-storybook to confirm the issue. @mohanpdModestine
V
3

npm i --save-dev @storybook/react work for me!

Vega answered 8/10, 2020 at 16:2 Comment(0)
T
1

First of all, just make sure you are in the right folder. I know it sounds dumb, but when we are tired sometimes we commit dumb errors

Tillotson answered 12/10, 2021 at 12:54 Comment(0)
H
0

In my case restarting the system hasn't helped. But reinstalling the application help.

Hayden answered 2/4, 2021 at 10:16 Comment(0)
E
0

I had this happen after deleting my node_modules folder (rm -rf node_modules) and then re-installing.

I checked all the all versions of storybook (and anything related to storybook) in my package.json and made sure they all had exact versions at 6.5 like

 "storybook": "6.5.14",
 "@storybook/react": "6.5.16",
 "@storybook/addon-docs": "6.5.16",

After deleting and installing again, it worked!

Obviously do not upgrade if you want to remain on 6.5 and continue to use this start-storybook command

Enkindle answered 20/6, 2023 at 15:24 Comment(0)
S
0

If you updated to v7 just run migration script:

npx storybook@next automigrate
Stacistacia answered 23/12, 2023 at 17:35 Comment(0)
D
0

First check the storybook version, If you're on storybook V7 then storybook-build commands will not work. You've to update your commands using npx storybook@next automigrate and for detailed steps please refer official page https://storybook.js.org/docs/sharing/publish-storybook

Derek answered 11/4 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.