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.
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.
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:
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:
create a storybook:
run the storybook:
Nx Report