storybook: Storybook does not work with RN0.59.+

Describe the bug Unable to load findSymlinksPaths: Cannot find module ‘react-native/local-cli/util/findSymlinksPaths’

error: unknown option `–projectRoots’

To Reproduce Steps to reproduce the behavior:

  1. Upgrade to latest react-native version
  2. run storybook start -p 7007 | react-native start --projectRoot storybook

Additional context I think the problem is because the path is wrong, now the cli is from @react-community/cli

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

The solution for me was to modify package.json to :

    "@storybook/addon-actions": "4.0.11",
    "@storybook/addon-knobs": "4.0.11",
    "@storybook/addon-links": "4.0.11",
    "@storybook/addon-ondevice-knobs": "4.1.16",
    "@storybook/addon-ondevice-notes": "4.0.11",
    "@storybook/addons": "4.0.11",
    "@storybook/react-native": "4.0.11",

work well with react-native 0.59.2

I’ve solved this adding react-dom as devDep and then adding this to metro.config.js:

const path = require('path');

module.exports = {
  projectRoot: path.resolve(__dirname, '.'),

  watchFolders: [
    path.resolve(__dirname, 'node_modules'),
  ],

  resolver: {
    // https://github.com/facebook/metro/issues/1#issuecomment-453450709
    extraNodeModules: new Proxy({}, {
      get: (target, name) => path.join(process.cwd(), `node_modules/${name}`),
    }),
  },

  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};