Issue when serving Storybook 8.2.2
C0ZEN opened this issue · comments
Current Behavior
When running a Storybook serving command like nx storybook my-lib
, I have the following error NX Invariant failed: Expected package.json#version to be defined in the "undefined" package}
on Storybook 8.2.2
which was not the case in Storybook 8.1.11
.
Expected Behavior
No error.
GitHub Repo
No response
Steps to Reproduce
- Migrate from Storybook
8.1.11
to8.2.2
- Serve a storybook instance
Nx Report
Node : 20.12.2
OS : darwin-arm64
npm : 10.5.0
nx : 19.4.2
@nx/js : 19.4.2
@nx/linter : 19.4.2
@nx/eslint : 19.4.2
@nx/workspace : 19.4.2
@nx/cypress : 19.4.2
@nx/devkit : 19.4.2
@nx/eslint-plugin : 19.4.2
@nx/react : 19.4.2
@nx/storybook : 19.4.2
@nrwl/tao : 19.4.2
@nx/vite : 19.4.2
@nx/web : 19.4.2
typescript : 5.4.5
---------------------------------------
Community plugins:
@koliveira15/nx-sonarqube : 4.1.0
nx-stylelint : 17.1.5
Failure Logs
Error: Invariant failed: Expected package.json#version to be defined in the "undefined" package}
at invariant (/Users/mac/Documents/github/repo-x/front/node_modules/@storybook/core/dist/core-server/index.cjs:187629:11)
at buildDevStandalone (/Users/mac/Documents/github/repo-x/front/node_modules/@storybook/core/dist/core-server/index.cjs:189878:3)
at Object.build (/Users/mac/Documents/github/repo-x/front/node_modules/@storybook/core/dist/core-server/index.cjs:190005:12)
at runInstance (/Users/mac/Documents/github/repo-x/front/node_modules/@nx/storybook/src/executors/storybook/storybook.impl.js:26:18)
at storybookExecutor (/Users/mac/Documents/github/repo-x/front/node_modules/@nx/storybook/src/executors/storybook/storybook.impl.js:12:26)
at storybookExecutor.next (<anonymous>)
at getLastValueFromAsyncIterableIterator (/Users/mac/Documents/github/repo-x/front/node_modules/nx/src/utils/async-iterator.js:15:34)
at iteratorToProcessStatusCode (/Users/mac/Documents/github/repo-x/front/node_modules/nx/src/command-line/run/run.js:44:94)
at /Users/mac/Documents/github/repo-x/front/node_modules/nx/src/command-line/run/run.js:187:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
Building Storybook is working (nx build-storybook my-lib
).
Seeing same issue after migrating from NX 19.3 -> 19.4.2 after already having had Storybook 8.2.2 as a dep.
same nx 19.1 -> 19.4.2
If you remove the storybook-related settings from each project in the monorepo, it will work, but you will lose the ability to customize.
I think we can check this code
function serveTarget(projectRoot, frameworkIsAngular, projectName, configFilePath) {
if (frameworkIsAngular) {
return {
executor: '@storybook/angular:start-storybook',
options: {
configDir: `${(0, path_1.dirname)(configFilePath)}`,
browserTarget: `${projectName}:build-storybook`,
compodoc: false,
},
};
}
else {
return {
command: `storybook dev`,
options: { cwd: projectRoot },
};
}
}
Same with 8.2.4
Same here 😞
There is a known breaking change issue with Storybook 8.2 for Nx workspaces. The storybook team have been in contact with us and we'll be working together to get a solution asap.