Skip to content

[Bug] Installing on an existing 7.6.17 causes storybook to crash -- can't find module node-logger #22

@seamus-sc

Description

@seamus-sc

Describe the bug

When trying to install Tailwind/Postcss on my existing Storybook 7.6.17 project, adding the '@storybook/addon-styling-webpack' add on causes storybook to crash with message:

Error: Cannot find module 'storybook/internal/node-logger'

Steps to reproduce the behavior

  1. Start with an existing 7.6.17 project with React/Webpack5
  2. npx storybook@7.6.17 add @storybook/addon-styling-webpack
  3. Y to install missing dependencies (style-loader, css-loader, postcss-loader)
  4. npm run storybook
  5. Error:
SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: ./.storybook/main.js.

Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.

If you believe this is a bug, please open an issue on Github.

SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: ./node_modules/@storybook/addon-styling-webpack/dist/preset.js.

Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.

If you believe this is a bug, please open an issue on Github.

Error: Cannot find module 'storybook/internal/node-logger'
Require stack:
- ./node_modules/@storybook/addon-styling-webpack/node_modules/@storybook/node-logger/shim.js
- ./node_modules/@storybook/addon-styling-webpack/dist/preset.js
- ./node_modules/@storybook/core-common/dist/index.js
- ./node_modules/@storybook/telemetry/dist/index.js
- ./node_modules/@storybook/cli/dist/generate.js
- ./node_modules/@storybook/cli/bin/index.js
- ./node_modules/storybook/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._resolveFilename (./node_modules/esbuild-register/dist/node.js:4799:36)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (./node_modules/@storybook/addon-styling-webpack/node_modules/@storybook/node-logger/shim.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Object.newLoader (./node_modules/esbuild-register/dist/node.js:2262:9)
    at extensions..js (./node_modules/esbuild-register/dist/node.js:4838:24)
    at loadPreset (./node_modules/@storybook/core-common/dist/index.js:15:82)
    at loadPreset (./node_modules/@storybook/core-common/dist/index.js:15:82)
    at async Promise.all (index 1)
    at async loadPresets (./node_modules/@storybook/core-common/dist/index.js:15:505)
    at async getPresets (./node_modules/@storybook/core-common/dist/index.js:15:1525)
    at async buildDevStandalone (./node_modules/@storybook/core-server/dist/index.js:119:1696)
    at async withTelemetry (./node_modules/@storybook/core-server/dist/index.js:65:3948)
    at async dev (./node_modules/@storybook/cli/dist/generate.js:514:401)
    at async Command.<anonymous> (./node_modules/@storybook/cli/dist/generate.js:529:225)

6. Removing '@storybook/addon-styling-webpack' from `addons` returns storybook to a working state, though without postcss support still. 

Expected behavior

Storybook should run as before, adding the plugin.

Screenshots and/or logs

If applicable, add screenshots and/or logs to help explain your problem.

Environment

  • OS: Mac OS 13.6.7
  • Node.js version: 20.15.0
  • NPM version: 10.7.0
  • Browser (if applicable): NA
  • Browser version (if applicable): NA
  • Device (if applicable): NA

Additional context

Looking at storybook core, it looks like they may have moved the node-logger about 3 weeks ago? Not sure if that effects the dist build or if it was just in src. Not sure if this is related, but here's the commit storybookjs/storybook@8505d86

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions