storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[Bug]: Cannot find module '@storybook/global'

Open jwittekind opened this issue 1 year ago • 1 comments

Describe the bug

Suddenly after reinstalling my node_modules i cannot start my storybook dev server again. I'm not sure whether this is related to: https://github.com/storybookjs/storybook/issues/25130

Error: Cannot find module '@storybook/global'
    at webpackEmptyContext (http://localhost:4400/main.iframe.bundle.js:606:10)
    at ../../lib/channels/dist/index.js (http://localhost:4400/vendors-node_modules_storybook_addon-essentials_dist_actions_preview_js-node_modules_storyboo-9ff264.iframe.bundle.js:104060:26)
    at http://localhost:4400/vendors-node_modules_storybook_addon-essentials_dist_actions_preview_js-node_modules_storyboo-9ff264.iframe.bundle.js:100320:50
    at ./node_modules/@storybook/addon-actions/dist/index.js (http://localhost:4400/vendors-node_modules_storybook_addon-essentials_dist_actions_preview_js-node_modules_storyboo-9ff264.iframe.bundle.js:104410:31)
    at __webpack_require__ (http://localhost:4400/runtime~main.iframe.bundle.js:28:33)
    at fn (http://localhost:4400/runtime~main.iframe.bundle.js:338:21)
    at ./node_modules/storybook-addon-angular-router/dist/actionLoggingRouter.js (http://localhost:4400/vendors-node_modules_storybook_addon-essentials_dist_actions_preview_js-node_modules_storyboo-9ff264.iframe.bundle.js:142568:21)
    at __webpack_require__ (http://localhost:4400/runtime~main.iframe.bundle.js:28:33)
    at fn (http://localhost:4400/runtime~main.iframe.bundle.js:338:21)
    at ./node_modules/storybook-addon-angular-router/dist/withAngularRouter.js (http://localhost:4400/vendors-node_modules_storybook_addon-essentials_dist_actions_preview_js-node_modules_storyboo-9ff264.iframe.bundle.js:142777:28)

I'm Using angular in an nx monorepo and created a custom ui library with a storybook installation.

/my-monorepo
├── apps
└── libs
    └── my-ui
        ├── .storybook
        │   ├── main.ts
        │   ├── preview.ts
        │   ├── theme.ts
        │   ├── manager.ts
        │   └── tsconfig.json
        └── components
            └── ...

This is an excerpt of my package json:

{
    "devDependencies": {
        ...
        "@angular/cli": "~17.1.0",
        "@nx/angular": "17.3.2",
        "@nx/storybook": "17.3.2",
        "@storybook/addon-links": "^7.6.3",
        "@storybook/addon-essentials": "7.6.14",
        "@storybook/angular": "7.6.14",
        "@storybook/core-server": "7.6.14", 
        ...
    }
}

To Reproduce

No response

System

Storybook Environment Info:

  System:
    OS: macOS 14.3.1
    CPU: (10) arm64 Apple M1 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    npm: 10.4.0 - ~/.nvm/versions/node/v18.19.0/bin/npm <----- active
    pnpm: 8.15.1 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 121.0.6167.160
    Safari: 17.3.1
  npmPackages:
    @storybook/addon-essentials: ^7.6.15 => 7.6.15 
    @storybook/addon-links: ^7.6.15 => 7.6.15 
    @storybook/angular: ^7.6.15 => 7.6.15 
    @storybook/core-server: ^7.6.15 => 7.6.15 
    eslint-plugin-storybook: ^0.6.11 => 0.6.15 
    storybook-addon-angular-router: ^1.9.2 => 1.9.2

Additional context

No response

jwittekind avatar Feb 14 '24 12:02 jwittekind

Seems to be related to: https://github.com/Jakob-em/storybook-addon-angular-router/issues/26

jwittekind avatar Feb 14 '24 12:02 jwittekind

we will be tracking this issue on #26126 so closing this one as dupe.

vanessayuenn avatar Feb 21 '24 15:02 vanessayuenn

Hey there! Thank you so much for reporting. We created a fix for Storybook 8 and released a canary containing it which can be tested by running:

npx [email protected] upgrade

Once the fix is confirmed and merged, we will patch it to Storybook 7.6 as well.

Would you mind testing it out and letting us know? 🙏

yannbf avatar Feb 22 '24 16:02 yannbf