- Clone this repo
- Run
npm install
- Run
nx storybook rapp1
This is how I created this repo, no need to do these steps too, since I already did them.
- I generated a new Nx workspace using
npx create-nx-workspace@latest
using React as preset - I added Storybook using
nx g @nrwl/react:storybook-configuration
- I ran
npx storybook@next upgrade --config-dir apps/rapp1/.storybook
to upgrade Storybook tonext
version
Storybook runs successfully, however I got this warning:
nx storybook rapp1
> nx run rapp1:storybook
@storybook/cli v8.0.0-rc.0
Storybook failed to check addon compatibility Error: No Storybook dependencies found in the package.json
at getIncompatibleStorybookPackages (/Users/fileas/Projects/nrwl/test-nx-workspaces/story-latest/node_modules/@storybook/core-server/dist/index.js:53:358)
at async warnOnIncompatibleAddons (/Users/fileas/Projects/nrwl/test-nx-workspaces/story-latest/node_modules/@storybook/core-server/dist/index.js:56:95)
at async buildDevStandalone (/Users/fileas/Projects/nrwl/test-nx-workspaces/story-latest/node_modules/@storybook/core-server/dist/index.js:65:1807)
at async withTelemetry (/Users/fileas/Projects/nrwl/test-nx-workspaces/story-latest/node_modules/@storybook/core-server/dist/index.js:28:3579)
at async dev (/Users/fileas/Projects/nrwl/test-nx-workspaces/story-latest/node_modules/@storybook/cli/dist/generate.js:634:563)
at async Command.<anonymous> (/Users/fileas/Projects/nrwl/test-nx-workspaces/story-latest/node_modules/@storybook/cli/dist/generate.js:636:250)
info => Starting manager..
info => Starting preview..
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
╭──────────────────────────────────────────────────────╮
│ │
│ Storybook 8.0.0-rc.0 for react-vite started │
│ 82 ms for manager and 619 ms for preview │
│ │
│ Local: http://localhost:52150/ │
│ On your network: http://192.168.68.115:52150/ │
│ │
╰──────────────────────────────────────────────────────╯
^C%
- The
npx storybook upgrade
command created apackage.json
in myapps/rapp1
project directory. - Storybook does not take into account the root
package.json
and looks inside the project-levelpackage.json
only to check for Storybook dependencies.
Everything else works as expected!
nx build-storybook rapp1
nx storybook rapp1
and while storybook
is running then run:
nx test-storybook rapp1 --url http://localhost:52062/ (or whichever port it is running on)
nx static-storybook rapp1