storybookjs / test-runner

🚕 Turn stories into executable tests
https://storybook.js.org/docs/writing-tests/interaction-testing
MIT License
228 stars 72 forks source link

[Bug]: Cannot find module 'storybook/internal/common' #505

Open eavam opened 3 weeks ago

eavam commented 3 weeks ago

Describe the bug

Running yarn test-storybook responds with an error Cannot find module 'storybook/internal/common'. On version 0.16 everything is fine. With 0.17 the problems start.

To Reproduce

node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module 'storybook/internal/common'
Require stack:
- <-- PATH -->/node_modules/@storybook/test-runner/node_modules/@storybook/core-common/shim.js
- <-- PATH -->/node_modules/@storybook/test-runner/dist/test-storybook.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (<-- PATH -->/node_modules/@storybook/test-runner/node_modules/@storybook/core-common/shim.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '<-- PATH -->/node_modules/@storybook/test-runner/node_modules/@storybook/core-common/shim.js',
    '<-- PATH -->/node_modules/@storybook/test-runner/dist/test-storybook.js'
  ]
}

System

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 4.1.1 - ~/.nvm/versions/node/v20.10.0/bin/yarn <----- active
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
  Browsers:
    Chrome: 127.0.6533.120
    Safari: 17.5
  npmPackages:
    @storybook/addon-essentials: 8.1.1 => 8.1.1 
    @storybook/addon-interactions: 8.1.1 => 8.1.1 
    @storybook/addon-links: 8.1.1 => 8.1.1 
    @storybook/blocks: 8.1.1 => 8.1.1 
    @storybook/preview-api: 8.1.1 => 8.1.1 
    @storybook/react: 8.1.1 => 8.1.1 
    @storybook/react-vite: 8.1.1 => 8.1.1 
    @storybook/test: 8.1.1 => 8.1.1 
    @storybook/test-runner: 0.17.0 => 0.17.0 
    eslint-plugin-storybook: 0.8.0 => 0.8.0 
    msw-storybook-addon: 2.0.3 => 2.0.3 
    storybook: 8.1.1 => 8.1.1 
    storybook-addon-mock: 5.0.0 => 5.0.0

Additional context

No response

kumarbha commented 3 weeks ago

I am also facing the same issue. Pls help

bklatka commented 3 weeks ago

Facing same issue as above

dudiharush commented 3 weeks ago

Me too...

dudiharush commented 2 weeks ago

This bug seems to be resolved after running: npx storybook@8.2.0 upgrade @eavam @kumarbha

SoaresMG commented 2 weeks ago

Same here, but I'm using storybook@7.6.19 with @storybook/test-runner@0.17.0 (I have also tried 0.19.1).

I did upgrade other deps that's when the issue started happening, I'm trying to find which one caused it

ericsoderberghp commented 2 weeks ago

FYI, I've found that if I remove @storybook/addon-designs then the error goes away and I am able to run.

SoaresMG commented 2 weeks ago

Same here, but I'm using storybook@7.6.19 with @storybook/test-runner@0.17.0 (I have also tried 0.19.1).

I did upgrade other deps that's when the issue started happening, I'm trying to find which one caused it

It seems that my issue was related with being in storybook@7 using test-runner@0.17.0 which had storybook@8 deps.

I switched to 0.16.0 and it started working again.

It was working before with storybook@7 due to the magic hand of the lock file god, that allowed some storybook@8.0.5 deps to be mixed with storybook@7 itself (if I'm not mistaken it was some deps like @storybook/channels and @storybook/types and 1-2 more).

sunilrathore24 commented 6 days ago

Same here - it used to work earlier but probably because of some minor version upgrades, it fails with the below error. @yannbf can you look into it? image

  "devDependencies": {
    "@angular-devkit/build-angular": "18.0.2",
    "@angular-devkit/core": "18.0.2",
    "@angular-devkit/schematics": "18.0.2",
    "@angular-eslint/eslint-plugin": "18.0.1",
    "@angular-eslint/eslint-plugin-template": "18.0.1",
    "@angular-eslint/template-parser": "18.0.1",
    "@angular/cli": "~18.0.0",
    "@angular/compiler-cli": "18.0.1",
    "@angular/language-service": "18.0.1",
    "@babel/core": "^7.24.7",
    "@babel/plugin-proposal-decorators": "^7.24.7",
    "@babel/preset-env": "^7.24.7",
    "@babel/preset-typescript": "^7.24.7",
    "@commitlint/cli": "^17.0.2",
    "@commitlint/config-conventional": "^17.0.2",
    "@commitlint/prompt-cli": "^17.0.0",
    "@custom-elements-manifest/analyzer": "~0.5.7",
    "@mjhenkes/postcss-rtl": "^2.0.0",
    "@nx/cypress": "19.3.2",
    "@nx/eslint": "19.3.2",
    "@nx/eslint-plugin": "19.3.2",
    "@nx/js": "19.3.2",
    "@nx/storybook": "19.3.2",
    "@nx/workspace": "19.3.2",
    "@open-wc/testing": "^3.1.6",
    "@rollup/plugin-alias": "^5.1.0",
    "@rollup/plugin-node-resolve": "^15.2.3",
    "@rollup/plugin-terser": "^0.4.4",
    "@rollup/plugin-typescript": "^11.1.6",
    "@rollup/plugin-virtual": "^3.0.2",
    "@schematics/angular": "18.0.2",
    "@storybook/addon-a11y": "^8.1.7",
    "@storybook/addon-essentials": "^8.1.7",
    "@storybook/addon-webpack5-compiler-babel": "^3.0.3",
    "@storybook/angular": "^8.1.7",
    "@storybook/blocks": "^8.1.7",
    "@storybook/components": "^8.1.7",
    "@storybook/core-events": "^8.1.7",
    "@storybook/core-server": "^8.1.7",
    "@storybook/manager-api": "^8.1.7",
    "@storybook/preview-api": "^8.1.7",
    "@storybook/test-runner": "^0.19.1",
    "@storybook/theming": "^8.1.7",
    "@storybook/types": "^8.1.7",
    "@storybook/web-components": "^8.1.7",
    "@storybook/web-components-webpack5": "^8.1.7" }