Storybook: sh: start-storybook: command not found

Created on 14 Jul 2016  ·  27Comments  ·  Source: storybookjs/storybook

what's wrong?

> [email protected] 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! [email protected] storybook: `start-storybook -p 9001`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] storybook script 'start-storybook -p 9001'[email protected] 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! [email protected] storybook: `start-storybook -p 9001`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] storybook script 'start-storybook -p 9001'
bug cli has workaround

Most helpful comment

I did rm -rf node_modules and then npm install.

All 27 comments

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

Great.

I'm also experiencing this issue:

→ npm run storybook

> [email protected] 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! [email protected] storybook: `start-storybook -p 6006`
npm ERR! spawn ENOENT
→ npm -v
4.0.5
→ node -v
v7.4.0

Any ideas?

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

@UsulPro do you mind looking into the Windows situation for @storybook/cli and help @axed ?

λ node -v
v8.1.2
λ npm ls -g --depth 0
e:\Node\nodejs
+-- @storybook/[email protected]
+-- [email protected]
`-- [email protected]
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! :relaxed:

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

Thanks @UsulPro . I'm pretty sure we are going to have to do a lot of surgery on 3.2.0-alpha before it comes out of alpha. I have not been involved in it much yet.

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   

> [email protected] 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! [email protected] storybook: `start-storybook -p 6006`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] 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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestorybook', 'storybook', 'poststorybook' ]
5 info lifecycle [email protected]~prestorybook: [email protected]
6 silly lifecycle [email protected]~prestorybook: no script for prestorybook, continuing
7 info lifecycle [email protected]~storybook: [email protected]
8 verbose lifecycle [email protected]~storybook: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~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 [email protected]~storybook: CWD: /Users/dtx/seahorse-web
11 silly lifecycle [email protected]~storybook: Args: [ '-c', 'start-storybook -p 6006' ]
12 info lifecycle [email protected]~storybook: Failed to exec storybook script
13 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] storybook: `start-storybook -p 6006`
24 error spawn ENOENT
25 error Failed at the [email protected] storybook script.
25 error This is probably not a problem with npm. There is likely additional logging output above.
26 verbose exit [ 1, true ]

@bailinlin could you give us additional information:

  • what version of storybook do yo use?
  • what version of getstorybook / @storybook/cli do you use?
  • what is your OS?

A lil update from my side. Maybe im understanding the whole installation process wrong, but one simple npm install whateveruwant will uninstall nearly all of storybook's dependencies after you installed and setup storybook.
I was a little surprised when i did a simple npm install apollo-client and suddenly npm removed like 1138 packages, added 1 package and storybook stopped working.
I have all of my storybook plugins and storybook itself aswell as non-dev dependencies within my package.json, to avoid situation like these.
The only solution i know, is to remove the node_modules directory, cleanly reinstall your dependencies with npm install and finally use getstorybook.cmd -f to destroy your story files, or else the script wont invoke yarn and start installing the missing dependencies.

@axed thanks for reporting this!

could you clarify? do you mean that npm i smth removes everything from devDependencies but holds dependencies?

and could you give us info about your OS and NPM version?

looks like npm bug on Windows

@UsulPro sure thing!
My package.json's devDependencies object is empty, or else it's modules had been removed upon each subsequent npm install somethingnew.
So i guess yes, every node module that is not listed in your package.json's dependencies object/list, will be removed from the local node_modules directory.

OS: Windows 10 1608 build 14393.1358
NPM: 5.0.3

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

is this closed? I have the same issue with the latest storybook (@next - 5.2.0-beta.19)

I installed cli globally and I get for example getstorybook functioning... but for some reason the start-storybook, build-storybook commands result in errors:

build-storybook : The term 'build-storybook' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the...

been trying to make storybook work on my windows machine for past couple of hours... but nothing works (the npx -p @storybook/cli sb init works completely fine)

@demiro is it only broken in 5.2.x, or do you know if it's also broken in earlier versions?

Seem to be getting this issue with Create react app, have removed the node_modules folder and re-installed. Doesn't seem to fix the issue

Seeing this issue as well.

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

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

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

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

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

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

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

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

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

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

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

Also worked for react xD

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

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

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
Was this page helpful?
0 / 5 - 0 ratings

Related issues

purplecones picture purplecones  ·  3Comments

zvictor picture zvictor  ·  3Comments

tomitrescak picture tomitrescak  ·  3Comments

levithomason picture levithomason  ·  3Comments

tirli picture tirli  ·  3Comments