storybook: sh: start-storybook: command not found

what’s wrong?

> redux-todomvc-example@0.0.0 storybook /Users/zhouming/Desktop/model/storybookmodel
> start-storybook -p 9001

sh: start-storybook: command not found

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "storybook"
npm ERR! node v6.2.2
npm ERR! nam  v3.9.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! sys call spawn
npm ERR! redux-todomvc-example@0.0.0 storybook: `start-storybook -p 9001`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the redux-todomvc-example@0.0.0 storybook script 'start-storybook -p 9001'edux-todomvc-example@0.0.0 storybook /Users/zhouming/Desktop/model/storybookmodel
> start-storybook -p 9001

sh: start-storybook: command not found

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "storybook"
npm ERR! node v6.2.2
npm ERR! nam  v3.9.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! sys call spawn
npm ERR! redux-todomvc-example@0.0.0 storybook: `start-storybook -p 9001`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the redux-todomvc-example@0.0.0 storybook script 'start-storybook -p 9001'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 43 (12 by maintainers)

Most upvoted comments

I’ve solved it by myself, because I didn’t use: ‘npm install’

I did rm -rf node_modules and then npm install.

Still the same here on Windows 10, Node 8.0 and NPM 5.0.3

Used Instructions from the website

npm i -g @storybook/cli
cd my-react-app
getstorybook

Same error.

EDIT: Turns out getstorybook doesnt even install storybook-react, even though it recognised the “create react app” base project. For anyone experiencing the same, just exec npm i --save-dev @storybook/react

For anybody who stumbles on this issue and is using Storybook 7.0, we’ve removed start-storybook and build-storybook:

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#start-storybook--build-storybook-binaries-removed

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#start-storybook--build-storybook-binaries-removed

tl;dr – build-storybook should be storybook build


From the Storybook Docs:

start-storybook / build-storybook binaries removed

❌ A typical Storybook project includes two scripts in your projects package.json:

{
  "scripts": {
    "storybook": "start-storybook <some flags>",
    "build-storybook": "build-storybook <some flags>"
  }
}

✅ To convert this project to 7.0:

{
  "scripts": {
    "storybook": "storybook dev <some flags>",
    "build-storybook": "storybook build <some flags>"
  },
  "devDependencies": {
    "storybook": "next"
  }
}

Neither of the commands works for me. I upgraded sb to ^7.0.0-alpha.52 and nothing budges. I tried:

  • cleaning cache "nuke": "rm -rf node_modules yarn.lock && yarn cache clean --all && yarn",
  • storybook dev -p 6006
  • start-storybook -p 6006

yarn -v #v1.22.19

node -v #v16.17.0

My sb packages:

    "@storybook/addon-a11y": "^7.0.0-alpha.52",
    "@storybook/addon-actions": "^7.0.0-alpha.52",
    "@storybook/addon-essentials": "^7.0.0-alpha.52",
    "@storybook/addon-interactions": "^7.0.0-alpha.52",
    "@storybook/addon-links": "^7.0.0-alpha.52",
    "@storybook/addon-postcss": "^3.0.0-alpha.1",
    "@storybook/addon-viewport": "^7.0.0-alpha.52",
    "@storybook/mdx2-csf": "^0.1.0-next.6",
    "@storybook/react": "^7.0.0-alpha.52",
    "@storybook/react-vite": "^7.0.0-alpha.52",
    "@storybook/testing-library": "^0.0.14-next.0",
    "@storybook/cli": "^7.0.0-alpha.52", 
    "storybook-addon-outline": "^1.4.2",
    "storybook-addon-sass-postcss": "^0.1.3",
    "storybook-dark-mode": "^1.1.3-canary.150.4195.0",

I had the same issue with @storybook/react and solved it as mentioned above:

npm i -D @storybook/react
yarn add -D @storybook/react

Also having this issue after upgrading to v7.0.2. Package diff below…

    "@storybook/addon-actions": "^5.1.9",
    "@storybook/addon-links": "^5.1.9",
    "@storybook/addons": "^5.1.9",
    "@storybook/react": "^5.1.9",

to

    "@storybook/addon-actions": "^7.0.2",
    "@storybook/addon-links": "^7.0.2",
    "@storybook/addons": "^7.0.2",
    "@storybook/react": "^7.0.2",

The problem is that there is no start-storybook cmd or binary for windows. How to get this tool?

I had the same issue with @storybook/vue and solved it as mentioned above:

npm i -D @storybook/vue yarn add -D @storybook/vue

Had this issue in an Ember app, this enabled the start-storybook command for me:

npm i -D @storybook/ember
yarn add -D @storybook/ember

By the way, if you used the CLI to initialize your project and then maybe tried using Docker and it didn’t work, you have to install the CLI as a dependency too.

# Using npm
npm i -D @storybook/cli

# Using yarn
yarn add -D @storybook/cli

@Rodnorm using both npm dependency managers is not a good idea. You should stick to one to manage a repo.

Seeing this issue as well.

  • Storybook 5.1.11
  • NPM v6.9.0
  • node v10.16.0
  • yarn v1.17.3

Hello,

Same error. I have installed the latest version of @storybook/vue

    "@storybook/vue": "7.0.12",

and the binaries are now missing (only test-storybook for test-runner, but not related…):

$ ls ./node_modules/.bin/*storybook*
./node_modules/.bin/test-storybook

@shilman, or other, any idea ?

Regards

lolmaus’s solution also works for @storybook/angular.

npm i -D @storybook/angular
yarn add -D @storybook/angular

I’m also experiencing this issue:

→ npm run storybook

> client@0.0.0 storybook /Users/alexbake/projects/my-project
> start-storybook -p 6006

sh: start-storybook: command not found

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/usr/local/bin/npm" "run" "storybook"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! client@0.0.0 storybook: `start-storybook -p 6006`
npm ERR! spawn ENOENT
→ npm -v
4.0.5
→ node -v
v7.4.0

Any ideas?

Also having this issue after upgrading to v7.0.2. Package diff below…

    "@storybook/addon-actions": "^5.1.9",
    "@storybook/addon-links": "^5.1.9",
    "@storybook/addons": "^5.1.9",
    "@storybook/react": "^5.1.9",

to

    "@storybook/addon-actions": "^7.0.2",
    "@storybook/addon-links": "^7.0.2",
    "@storybook/addons": "^7.0.2",
    "@storybook/react": "^7.0.2",

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#start-storybook--build-storybook-binaries-removed

I’ve got the same issue, running yarn storybook after upgrading to 7.0.0-beta.38 does not work.

What does work is to copy the package.json (updated to v7) to a different folder, installing, running npx sb@next init. yarn storybook will work in this folder.

I don’t know enough of how npm sets up its binaries and such to know how to troubleshoot this any further. The nuke option by @pawelkrystkiewicz above here has no effect.

Note: node_modules/.bin/storybook is present, so running ./node_modules/.bin/storybook dev does work.

sudo rm -rf node_modules && sudo rm -rf package-lock.json solved for me

👆 I believe it’s npm cache clean --force

I’m also experiencing this issue, run npm install still not work, but I remove the total node_modules then run npm install can work

 npm run storybook   

> react-redux-saga-boilerplate@0.4.0 storybook /Users/dtx/seahorse-web
> start-storybook -p 6006

sh: start-storybook: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-redux-saga-boilerplate@0.4.0 storybook: `start-storybook -p 6006`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the react-redux-saga-boilerplate@0.4.0 storybook script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dtx/.npm/_logs/2017-07-08T09_04_22_397Z-debug.log

and there is my error log :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'storybook' ]
2 info using npm@5.0.4
3 info using node@v7.0.0
4 verbose run-script [ 'prestorybook', 'storybook', 'poststorybook' ]
5 info lifecycle react-redux-saga-boilerplate@0.4.0~prestorybook: react-redux-saga-boilerplate@0.4.0
6 silly lifecycle react-redux-saga-boilerplate@0.4.0~prestorybook: no script for prestorybook, continuing
7 info lifecycle react-redux-saga-boilerplate@0.4.0~storybook: react-redux-saga-boilerplate@0.4.0
8 verbose lifecycle react-redux-saga-boilerplate@0.4.0~storybook: unsafe-perm in lifecycle true
9 verbose lifecycle react-redux-saga-boilerplate@0.4.0~storybook: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/dtx/seahorse-web/node_modules/.bin:/Users/dtx/.rvm/gems/ruby-2.3.0/bin:/Users/dtx/.rvm/gems/ruby-2.3.0@global/bin:/Users/dtx/.rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dtx/.rvm/bin
10 verbose lifecycle react-redux-saga-boilerplate@0.4.0~storybook: CWD: /Users/dtx/seahorse-web
11 silly lifecycle react-redux-saga-boilerplate@0.4.0~storybook: Args: [ '-c', 'start-storybook -p 6006' ]
12 info lifecycle react-redux-saga-boilerplate@0.4.0~storybook: Failed to exec storybook script
13 verbose stack Error: react-redux-saga-boilerplate@0.4.0 storybook: `start-storybook -p 6006`
13 verbose stack spawn ENOENT
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:877:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid react-redux-saga-boilerplate@0.4.0
15 verbose cwd /Users/dtx/seahorse-web
16 verbose Darwin 15.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "storybook"
18 verbose node v7.0.0
19 verbose npm  v5.0.4
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error react-redux-saga-boilerplate@0.4.0 storybook: `start-storybook -p 6006`
24 error spawn ENOENT
25 error Failed at the react-redux-saga-boilerplate@0.4.0 storybook script.
25 error This is probably not a problem with npm. There is likely additional logging output above.
26 verbose exit [ 1, true ]
λ node -v
v8.1.2
λ npm ls -g --depth 0
e:\Node\nodejs
+-- @storybook/cli@3.2.0-alpha.0
+-- create-react-app@1.3.1
`-- npm@5.0.3
create-react-app test
cd test
getstorybook
rem yarn add @storbook/components --dev
rem to fix @storbook/components issue
yarn storybook
yarn storybook v0.19.1
$ start-storybook -p 9009 -s public
@storybook/react v3.1.3

=> Loading static files from: E:\DevelopWeb\_Storybook\sandbox\test1\public .
=> Loading custom addons config.
=> Using default webpack setup based on "Create React App".
webpack built 22ebae935fef959ad46c in 5352ms
Storybook started on => http://localhost:9009/

so it installs and works fine. But actually, when I on the Windows I use cmder instead of native cmd.com - it’s the only way to survive with Windows for me! ☺️

I tried to do the same on the cmd terminal and I’ve got an error after npm run storybook (getstorybook works fine actually):

@storybook/react v3.1.3

=> Loading static files from: e:\DevelopWeb\_Storybook\sandbox\test2\public .
=> Loading custom addons config.
=> Using default webpack setup based on "Create React App".
 10% building modules 0/1 modules 1 active ...ok\react\dist\client\manager\index
 10% building modules 1/2 modules 1 active ...ok\sandbox\test2\.storybook\config
 10% building modules 2/2 modules 0 activeevents.js:182
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::9009
    at Object.exports._errnoException (util.js:1016:11)
    at exports._exceptionWithHostPort (util.js:1039:20)
    at Server.setupListenHandle [as _listen2] (net.js:1307:14)
    at listenInCluster (net.js:1355:12)
    at Server.listen (net.js:1455:7)

but since I didn’t do such tests before I can’t say is it a new issue or it existed before.

Anyway, I’m not sure that we could still have issues related to sh: start-storybook since we don’t use shell commands in our scripts. So I guess @axed’s case is something new and possible it’s worth to submit a new issue starting with detailed reproducing info

PS @shilman at this stage of @3.2.0-alpha we have an issue with @storybook/components requiring