storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
995 stars 142 forks source link

Unable to resolve "@storybook/react/dist/config" from "node_modules/@storybook/react-native/dist/preview.js" #531

Closed vvruspat closed 3 months ago

vvruspat commented 6 months ago

Describe the bug Fail to start storybook 7 Error: Unable to resolve "@storybook/react/dist/config" from "node_modules/@storybook/react-native/dist/preview.js" Check the screenshots for more info

As I see in the branch v7 everything already fixed since alpha-6, but in the final bundle from npm there is no that fixes.

Screenshots

Screenshot 2023-12-22 at 16 00 56 Screenshot 2023-12-22 at 16 04 00

System: Storybook Environment Info:

System: OS: macOS 13.6 CPU: (12) arm64 Apple M2 Pro Shell: 5.9 - /bin/zsh Binaries: Node: 20.10.0 - /usr/local/bin/node npm: 10.2.5 - /usr/local/bin/npm <----- active Browsers: Safari: 17.0 npmPackages: @storybook/addon-actions: ^7.6.6 => 7.6.6 @storybook/addon-controls: ^7.6.6 => 7.6.6 @storybook/addon-essentials: 7.6.6 => 7.6.6 @storybook/addon-interactions: ^7.6.6 => 7.6.6 @storybook/addon-knobs: ^7.0.2 => 7.0.2 @storybook/addon-links: 7.6.6 => 7.6.6 @storybook/addon-onboarding: ^1.0.10 => 1.0.10 @storybook/addon-ondevice-actions: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/addon-ondevice-backgrounds: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/addon-ondevice-controls: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/addon-ondevice-knobs: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/addon-ondevice-notes: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/addon-react-native-web: ^0.0.20-next.3 => 0.0.20 @storybook/blocks: ^7.6.6 => 7.6.6 @storybook/builder-webpack5: 7.6.6 => 7.6.6 @storybook/core-common: 7.6.6 => 7.6.6 @storybook/docs-tools: 7.6.6 => 7.6.6 @storybook/global: ^5.0.0 => 5.0.0 @storybook/native-addon: ^3.0.0 => 3.0.0 @storybook/react: 7.6.6 => 7.6.6 @storybook/react-native: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/react-native-server: ^7.0.0-alpha.8 => 7.0.0-alpha.8 @storybook/react-webpack5: ^7.6.6 => 7.6.6 @storybook/test: ^7.6.6 => 7.6.6 storybook: ^7.6.6 => 7.6.6

dannyhw commented 6 months ago

a fix is coming for this very soon it's due to changes in 7.6, if you revert to 7.5 it should work.

dannyhw commented 6 months ago

the problem is that in the v7 branch we've come across a different issue with addon-actions

dannyhw commented 3 months ago

this is fixed in the latest versions

possible-evan commented 2 months ago

I am having what looks to be a similar problem on 7.6.16 and 7.6.18

package.json versions

    "@storybook/addon-actions": "7.6.18",
    "@storybook/addon-controls": "7.6.18",
    "@storybook/addon-docs": "7.6.18",
    "@storybook/addon-knobs": "7.0.2",
    "@storybook/addon-links": "7.6.18",
    "@storybook/addon-ondevice-actions": "7.6.18",
    "@storybook/addon-ondevice-backgrounds": "7.6.18",
    "@storybook/addon-ondevice-controls": "7.6.18",
    "@storybook/addon-ondevice-knobs": "7.6.18",
    "@storybook/addons": "7.6.18",
    "@storybook/react": "7.6.18",
    "@storybook/react-native": "7.6.18",

the error output

ERROR in ./node_modules/@storybook/react-native/dist/preview.js 30:32-83
Module not found: Error: Package path ./dist/entry-preview-docs is not exported from package /Users/me/devel/client_mono/packages/mobile/node_modules/@storybook/react (see exports field in /Users/me/devel/client_mono/packages/mobile/node_modules/@storybook/react/package.json)

in ./node_modules/@storybook/react-native/dist/preview.js it's getting caught on this part here

var import_entry_preview_docs = require("@storybook/react/dist/entry-preview-docs");
var import_docs_tools = require("@storybook/docs-tools");
var preview_default = {
  argTypesEnhancers: [import_docs_tools.enhanceArgTypes],
  parameters: {
    docs: {
      extractArgTypes: import_entry_preview_docs.parameters.docs.extractArgTypes
    }
  }
};

it's not able to find require("@storybook/react/dist/entry-preview-docs");. but the file is indeed there within node_modules node_modules/@storybook/react/dist/entry-preview-docs. any ideas on how to resolve this?