besrabasant
besrabasant

Reputation: 2850

Error running storybook - sh: 1: start-storybook: not found

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

Upvotes: 28

Views: 60291

Answers (10)

just-be-weird
just-be-weird

Reputation: 1310

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

Upvotes: 0

egor.xyz
egor.xyz

Reputation: 3197

If you updated to v7 just run migration script:

npx storybook@next automigrate

Upvotes: 1

Cuminato
Cuminato

Reputation: 552

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

Upvotes: 10

headwinds
headwinds

Reputation: 1851

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

Upvotes: 0

Adebayo Ilerioluwa
Adebayo Ilerioluwa

Reputation: 339

Update start and build scripts

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

Upvotes: 13

mhnpd
mhnpd

Reputation: 391

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

Upvotes: 8

Yeonathan Aizenberg
Yeonathan Aizenberg

Reputation: 21

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

Upvotes: 1

Dima Dorogonov
Dima Dorogonov

Reputation: 2563

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

Upvotes: 0

imedadel
imedadel

Reputation: 315

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

Upvotes: 18

david pincheira
david pincheira

Reputation: 181

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

Upvotes: 3

Related Questions