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

sh: storybook: command not found #1726

Closed
jamesstar89 opened this issue Aug 24, 2017 · 8 comments
Closed

sh: storybook: command not found #1726

jamesstar89 opened this issue Aug 24, 2017 · 8 comments

Comments

@jamesstar89
Copy link

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!

@ndelangen
Copy link
Member

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.

@ghengeveld
Copy link
Member

ghengeveld commented Aug 24, 2017

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.

@designervga
Copy link

{
  "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.

@ndelangen
Copy link
Member

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

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

@ndelangen
Copy link
Member

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

I'm really certain it will!

@obibring
Copy link

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

@ndelangen
Copy link
Member

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

@jamesstar89
Copy link
Author

jamesstar89 commented Aug 25, 2017

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!!

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

5 participants