storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.22k stars 9.26k forks source link

sh: start-storybook: command not found #311

Closed KornbergFresnel closed 8 years ago

KornbergFresnel commented 8 years ago

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'
KornbergFresnel commented 8 years ago

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

arunoda commented 8 years ago

Great.

alexthebake commented 7 years ago

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?

bompi88 commented 7 years ago

I did rm -rf node_modules and then npm install.

alexhochreiter commented 7 years ago

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

shilman commented 7 years ago

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

usulpro commented 7 years ago
λ 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! :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):

```cmd @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

shilman commented 7 years ago

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.

bailinlin commented 7 years ago

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 ]
usulpro commented 7 years ago

@bailinlin could you give us additional information:

alexhochreiter commented 7 years ago

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.

usulpro commented 7 years ago

@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?

usulpro commented 7 years ago

looks like npm bug on Windows

alexhochreiter commented 7 years ago

@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

frankred commented 6 years ago

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

demiro commented 5 years ago

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)

shilman commented 5 years ago

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

dweng0 commented 5 years ago

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

newt-beach commented 5 years ago

Seeing this issue as well.

emrekeskinmac commented 5 years ago

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

lolmaus commented 4 years ago

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
teunw commented 4 years ago

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

npm i -D @storybook/angular
yarn add -D @storybook/angular
WretchedDade commented 4 years ago

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

npm i -D @storybook/react
yarn add -D @storybook/react
nazreen commented 4 years ago

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

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

Rodnorm commented 4 years ago

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

matheo commented 4 years ago

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

imedadel commented 4 years ago

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
BiskremMuhammad commented 2 years ago

try to delete node_modules and clean nm cache npm clean cache --force npm run npm install again,

rpearce commented 2 years ago

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

dpedersoli commented 1 year ago

I'm having this issue. Can someone please help me with this issue? image

This is the command: image


I've already tryied delete "node modules" -> clean cache -> "npm install"

(-npm -v -> 8.10.0

-node -v -> 16.11.1

'"@storybook/react": "^6.5.13"')

shilman commented 1 year ago

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

pawelkrystkiewicz commented 1 year ago

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

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",
tkbremnes commented 1 year ago

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.

sbland commented 1 year ago

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",
noru commented 1 year ago

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

AdamMescher commented 1 year ago

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"
  }
}
JBustin commented 1 year ago

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

windmaomao commented 1 year ago

Have you forgot to install the storybook dependency:

  "storybook": "7.0.20"

I installed a fresh new copy to another empty project, and seems to me this is the only differencne.

bvaughn commented 1 year ago

Noticed this myself, using the latest storybook release.

$ yarn why storybook  
└─ recordreplay-devtools@workspace:.
   └─ storybook@npm:7.0.24 (via npm:^7.0.24)

$ yarn build-storybook
command not found: build-storybook

If I install v6, a build-storybook binary is added to node_modules/.bin:

#!/usr/bin/env node

process.env.NODE_ENV = process.env.NODE_ENV || 'production';
require('../dist/cjs/server/build');

If I install v7, there is no build-storybook binary, but a storybook binary is added to node_modules/.bin:

#!/usr/bin/env node

require('@storybook/cli/bin/index');

Maybe you can work around the issue by running the command directly?

npx storybook build

Edit I think this is just a problem with outdated documentation. This page shows the correct command:

yarn storybook
jonniebigodes commented 1 year ago

@bvaughn thanks for reaching out to us. Appreciate it 🙏 ! Something is off I agree with that. And to your point, the documentation is not wrong. The first link you've mentioned (the outdated one), is correct, and it refers to one of the scripts added when Storybook is installed, specifically the one for generating a production build and it should have been updated if you're migrating or added if it's a fresh install.

bvaughn commented 1 year ago

And to your point, the documentation is not wrong.

Interesting! The docs here show

yarn build-storybook

Which, as of Storybook v6, used to be the way you built story book (via the binary added in node_modules) but doesn't seem to be the way any more.

The link you sent seems to be a particular project using Storybook:

    "build-storybook": "storybook build",

So while you would run yarn build-storybook in that project, the command it's running is actually storybook build (which is also what the installation page mentions– and what someone like me would need to run).

Maybe the docs could be clarified to avoid confusion for folks, given the binary rename between majors?

jonniebigodes commented 1 year ago

We have it here. If you want, you are more than welcome to push a pull request with a note mentioning this so that other users as yourself, can get some additional clarification on this. I'd be more than glad to review it. Sounds good?

Looking forward to hearing from you.

Have a great day

bvaughn commented 1 year ago

The "migration" page you linked to looks fine. It's not the page I ended up on when coming from Google search, which is what caused my confusion.

Normally I'd be happy to open a PR with a proposed docs change. In this case, I'm not sure how well it would fit into the larger tutorial (which often refers to the package.json script named build-storybook rather than the binary).

I'll defer to your judgement on whether that's worth changing or not.