question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native Storybook doesn't work with current CRNA

See original GitHub issue

Thanks for this awesome tool 👍 Unfortunately, we ran into some issue while upgrading our app to Expo 20. Apparently, react-inspector causes it.

TL;DR: When using React Native Storybook within a CRNA (Expo 20), React Native packager throws TransformError during bundling:

TransformError: {appPath}/node_modules/react-inspector/lib/index.js: Couldn't find preset "es2015" relative to directory "{appPath}/node_modules/react-inspector"

Versions:

"expo": "20.1.3"
"react": "16.0.0-alpha.12"
"react-dom": "16.0.0-alpha.12"
"react-native": "0.47.2"
"react-native-scripts": "1.3.1"
"@storybook/react-native": "3.2.8"

Steps to reproduce:

  1. Create a new CRNA or clone sample repo https://github.com/inyono/crna-storybook-expo20:
  • create-react-native-app
  • getstorybook
  • Replace App.js with export default from './storybook';
  1. yarn resp. npm install
  2. Start React Native packager with yarn start resp. npm start
  3. Open app in Expo
  • Error in terminal: Failed building JavaScript bundle
  • Error on device / simulator:
TransformError: {appPath}/node_modules/react-inspector/lib/index.js: Couldn't find preset "es2015" relative to directory "{appPath}/node_modules/react-inspector"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
inspireuicommented, Sep 12, 2017

Fixed by: npm install --save-dev babel-preset-es2015

Then add .babelrc file to storybook folder with the es2015 in presets.

Screenshot: https://gyazo.com/2e7b0214dc9f217391b242f4b045807d

0reactions
Hypnosphicommented, Sep 24, 2017

Until #1888 gets released and merged, the easiest fix for current apps is following:

  1. Remove all the @storybook/* dependencies
  2. Run npm install or yarn install depending on which lockfile do you use. This will remove the lock for react-inspector package
  3. Restore the dependencies and run install command again
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Storybook with React Native - Pusher
Start by installing Create React Native App (CRNA). We'll be using it to generate a new React Native project that works with Storybook:...
Read more >
storybook/addon-ondevice-knobs
Storybook on react native is a normal React Native component that can be used or hidden anywhere in your RN application based on...
Read more >
@storybook/react-native-server | Yarn - Package Manager
A better way to develop React Native Components for your app ... With Storybook for React Native you can design and develop individual...
Read more >
react-native-hybrid-storybook - npm package | Snyk
The current version is using latest react-native-web (of version ^0.9.0 ). It's compatible (with exsiting working examples) with Expo SDK 30 (using react-native...
Read more >
@storybook/react-native - npm
Start using @storybook/react-native in your project by running `npm i ... Addon-info - Fix immutable props issues with React 16 #1894 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found