Error running storybook - sh: 1: start-storybook: not found
Matthew Harrington
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 problemyarn version 1.3.2
29 Answers
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 Update start and build scripts
"storybook": "sb dev",
"build-storybook": "sb build" 1 This error is due to the node_modules folder. If you delete that folder and runnpm 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
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
npm i --save-dev @storybook/react work for me!
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
In my case restarting the system hasn't helped. But reinstalling the application help.
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
If you updated to v7 just run migration script:
npx storybook@next automigrate