storybookjs / addon-react-native-server

A replacement for @storybook/react-native-server which will enable multiple devices to sync over websockets
MIT License
7 stars 0 forks source link

[Bug] Unable to resolve module @storybook/addon-react-native-server/register #8

Closed machadogj closed 1 month ago

machadogj commented 1 month ago

Describe the bug

When launching react-native server with yarn start, after reloading the app on the mobile device I get an error message saying that it can't import /register.

Steps to reproduce the behavior

  1. Set up Storybook 8.3.3 in an existing react-native project.
  2. Add @storybook/addon-react-native-server
  3. run yarn start
  4. reload app

Expected behavior

A websocket server is started in the configured port (7007).

Screenshots and/or logs

yarn start
info Welcome to React Native v0.75
info Starting dev server on port 8081...

                        ▒▒▓▓▓▓▒▒
                     ▒▓▓▓▒▒░░▒▒▓▓▓▒
                  ▒▓▓▓▓░░░▒▒▒▒░░░▓▓▓▓▒
                 ▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓
                 ▓▓░░░░░▒▓▓▓▓▓▓▒░░░░░▓▓
                 ▓▓░░▓▓▒░░░▒▒░░░▒▓▒░░▓▓
                 ▓▓░░▓▓▓▓▓▒▒▒▒▓▓▓▓▒░░▓▓
                 ▓▓░░▓▓▓▓▓▓▓▓▓▓▓▓▓▒░░▓▓
                 ▓▓▒░░▒▒▓▓▓▓▓▓▓▓▒░░░▒▓▓
                  ▒▓▓▓▒░░░▒▓▓▒░░░▒▓▓▓▒
                     ▒▓▓▓▒░░░░▒▓▓▓▒
                        ▒▒▓▓▓▓▒▒

                Welcome to Metro v0.80.5
              Fast - Scalable - Integrated

info Dev server ready

i - run on iOS
a - run on Android
d - open Dev Menu
r - reload app

 BUNDLE  ./index.js 

error: Error: Unable to resolve module @storybook/addon-react-native-server/register from /Users/gus/app/mobile/.storybook/storybook.requires.ts: @storybook/addon-react-native-server/register could not be found within the project or in these directories:
  node_modules
   9 | import "@storybook/addon-ondevice-controls/register";
  10 | import "@storybook/addon-ondevice-actions/register";
> 11 | import "@storybook/addon-react-native-server/register";
     |         ^
  12 |
  13 | const normalizedStories = [
  14 |   {
    at ModuleResolver.resolveDependency (/Users/gus/app/mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:153:15)
    at DependencyGraph.resolveDependency (/Users/gus/app/mobile/node_modules/metro/src/node-haste/DependencyGraph.js:271:43)
    at /Users/gus/app/mobile/node_modules/metro/src/lib/transformHelpers.js:176:21
    at resolveDependencies (/Users/gus/app/mobile/node_modules/metro/src/DeltaBundler/buildSubgraph.js:56:25)
    at visit (/Users/gus/app/mobile/node_modules/metro/src/DeltaBundler/buildSubgraph.js:107:30)
    at async Promise.all (index 2)
    at async visit (/Users/gus/app/mobile/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
    at async Promise.all (index 7)
    at async visit (/Users/gus/app/mobile/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
    at async Promise.all (index 2)

Environment

Additional context

Tried with 0.0.5 and same error.

dannyhw commented 1 month ago

This addon is for web with addon-react-native-web it should not go in the ondevice addons list

machadogj commented 1 month ago

oh. I see. thanks.