nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.26k stars 2.32k forks source link

Bug: Cannot find module 'storybook/internal/common' in v19.6.2 #27614

Open wizardnet972 opened 3 weeks ago

wizardnet972 commented 3 weeks ago

Current Behavior

After creating a new Nx workspace with the Angular monorepo preset and installing Storybook using the Nx command, running Storybook results in the following error:

 NX   Cannot find module 'storybook/internal/common'

Require stack:
- /Users/wizardnet972/code/nx-storybook-common-problem/node_modules/@storybook/angular/dist/builders/start-storybook/index.js
- /Users/wizardnet972/code/nx-storybook-common-problem/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js

Pass --verbose to see the stacktrace.

Expected Behavior

Storybook should run successfully without any errors after installation in the Nx workspace with Angular.

GitHub Repo

https://github.com/wizardnet972/nx-storybook-common-problem

Steps to Reproduce

Clone it from https://github.com/wizardnet972/nx-storybook-common-problem (then npm install and run the storybook)

OR create a repo:

npx create-nx-workspace@latest --name nx-storybook-common-problem

 NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

✔ Which stack do you want to use? · angular
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · nx-storybook-common-problem
✔ Which bundler would you like to use? · esbuild
✔ Default stylesheet format · css
✔ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? · No
✔ Test runner to use for end to end (E2E) tests · none
✔ Which CI provider would you like to use? · skip
✔ Would you like remote caching to make your build faster? · skip

 NX   Creating your v19.6.2 workspace.

✔ Installing dependencies with npm
✔ Successfully created the workspace: nx-storybook-common-problem.

create a storybook:

 npx nx generate @nx/angular:storybook-configuration --project=nx-storybook-common-problem

 NX  Generating @nx/angular:storybook-configuration

✔ Do you want to set up Storybook interaction tests? (Y/n) · true
✔ Automatically generate *.stories.ts files for components declared in this project? (Y/n) · true
✔ Configure a static file server for the storybook instance? (Y/n) · true
Fetching @nx/storybook...
UPDATE nx.json
UPDATE package.json
CREATE apps/nx-storybook-common-problem/.storybook/main.ts
CREATE apps/nx-storybook-common-problem/.storybook/preview.ts
CREATE apps/nx-storybook-common-problem/.storybook/tsconfig.json
UPDATE apps/nx-storybook-common-problem/tsconfig.app.json
UPDATE apps/nx-storybook-common-problem/tsconfig.json
UPDATE apps/nx-storybook-common-problem/.eslintrc.json
UPDATE apps/nx-storybook-common-problem/project.json
CREATE apps/nx-storybook-common-problem/src/app/app.component.stories.ts
CREATE apps/nx-storybook-common-problem/src/app/nx-welcome.component.stories.ts
UPDATE apps/nx-storybook-common-problem/tsconfig.editor.json
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @storybook/testing-library@0.2.2: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.
npm warn deprecated @storybook/expect@28.1.3-5: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.
npm warn deprecated @storybook/jest@0.2.3: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.

added 467 packages, and audited 1931 packages in 23s

311 packages are looking for funding
  run npm fund for details

70 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run npm audit for details.

run the storybook:

npx nx run storybook

 NX   Both project and target have to be specified

Pass --verbose to see the stacktrace.

npx nx run nx-storybook-common-problem:storybook

> nx run nx-storybook-common-problem:storybook

 NX   Cannot find module 'storybook/internal/common'

Require stack:
- /Users/wizardnet972/code/nx-storybook-common-problem/node_modules/@storybook/angular/dist/builders/start-storybook/index.js
- /Users/wizardnet972/code/nx-storybook-common-problem/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
Pass --verbose to see the stacktrace.

Nx Report

npx nx report

 NX   Report complete - copy this into the issue template

Node           : 22.6.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.8.2

nx                 : 19.6.2
@nx/js             : 19.6.2
@nx/jest           : 19.6.2
@nx/linter         : 19.6.2
@nx/eslint         : 19.6.2
@nx/workspace      : 19.6.2
@nx/angular        : 19.6.2
@nx/cypress        : 19.6.2
@nx/devkit         : 19.6.2
@nx/eslint-plugin  : 19.6.2
@nx/storybook      : 19.6.2
@nrwl/tao          : 19.6.2
@nx/web            : 19.6.2
@nx/webpack        : 19.6.2
typescript         : 5.5.4
---------------------------------------
Community plugins:
@storybook/angular : 8.2.9


### Failure Logs

_No response_

### Package Manager Version

_No response_

### Operating System

- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)

### Additional Information

_No response_
jon9090 commented 2 weeks ago

same for me at v19.6.4.

any updates?

wizardnet972 commented 2 weeks ago

Hi @jon9090, I have a temporary workaround. You can add "storybook": "^8.2.9" to your package.json and install it. That should resolve the issue.