Storybook: ERR! on npm run storybook

Created on 25 Apr 2016  Â·  22Comments  Â·  Source: storybookjs/storybook

I get thesse errors: What am i doing wrong?
npm run storybook
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "run" "storybook"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3

npm ERR! missing script: storybook

discussion

Most helpful comment

@3DEsprit Thanks, just ran into the same issue, that npx -p @storybook/cli sb init fixed the issue

All 22 comments

I think you forgot to add the npm script. Add "storybook": "start-storybook -p 9001" under scripts in your package.json file. more info

The same situation:
"scripts": { "storybook": "start-storybook -p 9001" }

npm-debug.log.txt

I'm having the same issue. The storybook script is there, but I'm getting: "sh: 1: start-storybook: not found"

@decoursin Are you using windows?

I'm using Linux.

I switched from npm 2.x.z to 3.y,z, rm -rf node_modules, and now it's working. I'm not sure at all if this was the issue.

Switched the storybook to 1.6.0 version, and it started working fine. I'm using react 0.14.8.

created stories + config.
npm run storybook
after updated to 1.10.0 after to last, in both cases the storybook worked.

I had the same error becouse I had installed npm install react-storybook instead of npm install @kadira/storybook

Hi Guys i have same problem

$ npm run storybook
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "storybook"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4

npm ERR! missing script: storybook

Running on Windows
Storybook is clean only cloned from git

after npm install

> @kadira/[email protected] prepublish C:\Dev\react-storybook
> ./scripts/prepublish.sh

'.' is not recognized as an internal or external command,
operable program or batch file.

Hmm. Seems like we are only support bash. We need to add support for windows.

@szopenkrk can you follow these steps and try again?

  • add the npm script storybook to your projects package.json file if it's missing
{
  "scripts": {
+    "storybook": "start-storybook -p 9001"
  }
}
npm i -g npm@3
rd /s /q node_modules
npm i

if you're trying to use storybook with your react app, install from npm

npm i -D @kadira/storybook

If you're trying to contribute to this repo (thanks) please wait a few days until we make the prepublish script cross platform ( or you can help us out with that issue itself #300 ).

OK i have solution

npm i -g [email protected]
rm -rf node_modules
npm i

and in demo we dont need add "storybook": "start-storybook -p 9001" because we have it there.

I am also encountering this problem, despite trying all the fixes suggested above (including removing node modules and reinstalling them, adding storybook to the scripts in package.json etc)
I am using npm3,TypeScript 1.8.10, I installed with "npm i -D @kadira/storybook", and I am using Git Bash on a Windows 10 computer.
I attached my npm-debug log

npm-debug.txt

@satstanford try to use start-storybook instead ./node_modules/.bin/start-storybook

@mnmtanish thanks for your comment on installing from npm.

Could we add this command to the docs...

npm i -D @kadira/storybook

...explaining that this is how to install if you to run storybook-start from your npm scripts without installing Storybook globally?

I'm happy to do the PR myself.

@jonathanconway I think everything is documented properly.
See: https://getstorybook.io/docs/react-storybook/basics/slow-start-guide

This is package.json created after running create-react-app to create my-stories-app. You need to pay attentions to the default versions created for "react", "react-dom" and "react-scripts" under "dependencies":
{ "name": "my-stories-book", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.0.0", "react-dom": "^16.0.0", "react-scripts": "1.0.14" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook" }, "devDependencies": { "@kadira/storybook": "^2.35.3" } }

I probably looked through every answer, tried them, all not working. I even had gone to the point that finally "npm run storybook" didn't give me any error after "npm i -D @kadira/storybook" as provided by mnmtanish, but when I access http://localhost:6006, there was a run-time JS error that stated "... string ... not found" which I didn't know what it meant and didn't bother to trace.

Here is my new package.json in which I used specific versions that finally could bring up the app problems free. Again, pay attention to the versions of "react", "react-dom" and "react-scripts" under "dependencies".
{ "name": "my-stories-book", "version": "0.1.0", "private": true, "dependencies": { "react": "^15.4.2", "react-dom": "^15.4.2", "react-scripts": "0.8.5" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook" }, "devDependencies": { "@kadira/storybook": "^2.35.3" } }

The above is the proof that getstorybook is not updated with the default versions created by create-react-app.

@danideng Looks like you're using the outdated getstorybook package, the up-to-date one is called @cli/storybook

Related: #1604

Based on the information provided by Hypnosphi, here are the steps of my second try:

By following https://www.npmjs.com/package/@storybook/cli:

  1. C:...\test > create-react-app cli-story-book
  2. C:...\test > npm i -g @storybook/cli
  3. C:...\test > cd cli-story-book
  4. C:...\test > getstorybook
    • Detecting project type. ✓
    • Adding storybook support to your "Create React App" based project. ✓
    • Preparing to install dependencies. ✓
    ......
  5. C:...\test > npm run storybook
    ......

Storybook started on => http://localhost:9009/

Voila! Thank you very much, Hypnosphi.

I just had this happen when following the (Slow) Storybook for React docs with the latest version (4.1.1). Looking into it further, it looks like the sb init step is missing from the docs, telling users to start it up right after adding the script and config.

https://storybook.js.org/basics/guide-react/

So as long as I run sb init after setting up the config and before starting SB, all works as intended.

@3DEsprit Thanks, just ran into the same issue, that npx -p @storybook/cli sb init fixed the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sakulstra picture sakulstra  Â·  3Comments

xogeny picture xogeny  Â·  3Comments

tomitrescak picture tomitrescak  Â·  3Comments

levithomason picture levithomason  Â·  3Comments

purplecones picture purplecones  Â·  3Comments