Storybook: sh: storybook: command not found

Created on 24 Aug 2017  路  8Comments  路  Source: storybookjs/storybook

Hello,

Trying react-native with Storybook and failing.

Followed this:

  1. yarn create react-native-app myapp
  2. cd myapp
  3. getstorybook
  4. Update App.js
  5. npm run storybook

Step 5 not working.. see subject line - sh: storybook: command not found

Any help would be appreciated. Thanks!

react-native question / support

Most helpful comment

Yeah this makes sense... You need:
"@storybook/react-native": "^3.2.8"

NOT
"@storybook/react": "^3.2.8"

All 8 comments

make sure you're using the latest @storybook/cli. It provides the getstorybook command.

You could have a look at our react-native example here:
https://github.com/storybooks/storybook/tree/master/examples/react-native-vanilla

Check for difference in package.json, because something is causing some packages not to get installed.

I've just run getstorybook and it has updated my package.json to include the following in scripts:

"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"

You are probably missing that part.

~~
{
"name": "estudandoNative",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"storybook": "storybook start -p 7007"
},
"dependencies": {
"native-base": "^2.3.1",
"react": "^16.0.0-alpha.12",
"react-native": "0.47.2",
"react-native-svg": "^5.4.1"
},
"devDependencies": {
"@storybook/addon-actions": "^3.2.6",
"@storybook/addon-links": "^3.2.6",
"@storybook/react": "^3.2.8",
"react-dom": "^15.6.1",
"babel-jest": "20.0.3",
"babel-preset-react-native": "3.0.1",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12",
"prop-types": "^15.5.10"
},
"jest": {
"preset": "react-native"
}
}
~
~

Same problem here. I updated it today and still can't run the 'storybook' command.
I'm on Windows 10.

Yeah this makes sense... You need:
"@storybook/react-native": "^3.2.8"

NOT
"@storybook/react": "^3.2.8"

Please re-open this issue if this doesn't fix your problem

I'm really certain it will!

@ndelangen, thanks! Apart from incorrectly installing @storybook/react instead of @storybook/react-native, I see several @storybook related dependencies that were not installed in my local repo that are listed in the package.json file you referenced. Do I need to install the following?:

@storybook/addon-options
@storybook/addon-storyshots
@storybook/addons
@storybook/channels
@storybook/channel-postmessage
@storybook/components
@storybook/ui

And if so where do I get the versions for each package?

You could choose to install and use these:

@storybook/addon-options
@storybook/addon-storyshots

But they are optional. They are addons enriching storybook's functionality.

The other packages are internal and you do not need them inside your package.json.


You can view package versions on npmjs.com or in your terminal by running npm view <packagename>.

Hey everyone, thanks for all the replies, storybook is truely thriving!!

Here's what helped to get it working...

@ndelangen "@storybook/react-native": "^3.2.8" big ups!

And also installing some babel packages was needed...

babel-preset-es2015, babel-preset-stage-2

aWesome!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purplecones picture purplecones  路  3Comments

wahengchang picture wahengchang  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments

Jonovono picture Jonovono  路  3Comments

arunoda picture arunoda  路  3Comments