Storybook fails to launch without a default project
See original GitHub issueCurrent Behavior
If workspace.json does not set a default project, launching storybook after running nx g @nrwl/angular:storybook-configuration project-name
results in the following error
> nx run <project>:storybook
Cannot read property 'targets' of undefined
See https://github.com/nrwl/nx/blob/master/packages/storybook/src/executors/utils.ts#L188 and https://github.com/nrwl/nx/blob/master/packages/storybook/src/executors/utils.ts#L212, where defaultProjectName
ends up being undefined.
Expected Behavior
Launch storybook after initial configuration without additional modifications to workspace project configuration.
Steps to Reproduce
Setting projectBuildConfig
string equal to the name of the respective project in configuration (https://nx.dev/p/a/storybook/build#projectbuildconfig) seems to resolve.
Failure Logs
Environment
npx nx report
> NX Report complete - copy this into the issue template
Node : 12.22.7
OS : linux x64
yarn : 1.22.17
nx : 13.3.0
@nrwl/angular : 13.3.0
@nrwl/cli : 13.3.0
@nrwl/cypress : 13.3.0
@nrwl/devkit : 13.3.0
@nrwl/eslint-plugin-nx : 13.3.0
@nrwl/express : undefined
@nrwl/jest : 13.3.0
@nrwl/linter : 13.3.0
@nrwl/nest : 13.3.0
@nrwl/next : undefined
@nrwl/node : 13.3.0
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.3.0
@nrwl/web : undefined
@nrwl/workspace : 13.3.0
@nrwl/storybook : 13.3.6
@nrwl/gatsby : undefined
typescript : 4.5.3
rxjs : 7.4.0
---------------------------------------
Community plugins:
@angular/animations: 13.1.0
@angular/cdk: 13.1.0
@angular/common: 13.1.0
@angular/compiler: 13.1.0
@angular/core: 13.1.0
@angular/forms: 13.1.0
@angular/material: 13.1.0
@angular/platform-browser: 13.1.0
@angular/platform-browser-dynamic: 13.1.0
@angular/platform-server: 13.1.0
@angular/router: 13.1.0
angular-auth-oidc-client: 11.6.8
angular-datatables: 9.1.1
@angular-devkit/build-angular: 13.0.4
@angular/cli: 13.0.4
@angular/compiler-cli: 13.1.0
@angular/language-service: 13.1.0
@storybook/angular: 6.4.9
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:21 (14 by maintainers)
Top Results From Across the Web
Environment variables - Storybook - JS.ORG
By default, Storybook will open a new Chrome window as part of its startup process. If you don't have Chrome installed, make sure...
Read more >@storybook/builder-vite - npm
The default project root is set to the parent directory of the storybook configuration directory. This can be overridden in viteFinal. Known ...
Read more >Storybook in examples. Beginner's guide | LITSLINK | - Medium
NOTE: Storybook needs to be installed into a project that is already setup with a framework. It will not work on an empty...
Read more >Error message "error:0308010C:digital envelope routines ...
Open terminal and paste these as described: ... When you attempt to use SSL in Node.js v17 or later without also upgrading those...
Read more >Storybook in React Native - collective:mind | DEV
Our first goal is to get to the default Storybook and after that we ... Long story short this will allow us to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I meant that we’re running e2e tests and storybook like this:
nx e2e storybook-app-e2e
. And before e2e tests started, it tries to start storybook. It means that I need to pass--projectBuildConfig
there somehow.But I found solution, you need to pass
projectBuildConfig
to storybook optionsWould recommend at least a doc update, since it took me spinning up a debugger and tracking down the lines mentioned in my initial message to understand why this was failing. None of the getting started docs made any mention about default project setups, and the error caused is not obvious. The better solution in my mind is to just assume the
projectBuildConfig
value should be automatically set to the target project used when running the command if it’s not set, using the default project, even if available, as the default doesn’t make sense to me if I’m already launching using a specific project config.