Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR! on npm run storybook #145

Closed
Strutsagget opened this issue Apr 25, 2016 · 23 comments
Closed

ERR! on npm run storybook #145

Strutsagget opened this issue Apr 25, 2016 · 23 comments

Comments

@Strutsagget
Copy link

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

@thani-sh
Copy link
Contributor

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

@otmjka
Copy link

otmjka commented Apr 27, 2016

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

npm-debug.log.txt

@decoursin
Copy link

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

@arunoda
Copy link
Member

arunoda commented Apr 29, 2016

@decoursin Are you using windows?

@decoursin
Copy link

I'm using Linux.

@decoursin
Copy link

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.

@otmjka
Copy link

otmjka commented Apr 29, 2016

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

@otmjka
Copy link

otmjka commented Apr 29, 2016

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

@jurgob
Copy link
Contributor

jurgob commented Jun 26, 2016

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

@szopenkrk
Copy link

szopenkrk commented Jul 6, 2016

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/storybook@1.36.0 prepublish C:\Dev\react-storybook
> ./scripts/prepublish.sh

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

@arunoda
Copy link
Member

arunoda commented Jul 6, 2016

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

@thani-sh
Copy link
Contributor

thani-sh commented Jul 7, 2016

@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 ).

@szopenkrk
Copy link

OK i have solution

npm i -g npm@3.8.5
rm -rf node_modules
npm i

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

@satstanford
Copy link

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

@arunoda
Copy link
Member

arunoda commented Jul 29, 2016

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

@jonathanconway
Copy link

jonathanconway commented Oct 27, 2016

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

@arunoda
Copy link
Member

arunoda commented Oct 27, 2016

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

@arunoda arunoda closed this as completed Oct 27, 2016
@danideng
Copy link

danideng commented Oct 3, 2017

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.

@Hypnosphi
Copy link
Member

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

Related: #1604

@danideng
Copy link

danideng commented Oct 3, 2017

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.

@MutableLoss
Copy link

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.

@Sebs030
Copy link

Sebs030 commented Dec 14, 2018

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

@robozb
Copy link

robozb commented Jan 11, 2023

same problem here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests