New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storybook fails to launch without a default project #8199
Comments
Hi there @nick-allen ! Thanks for filing an issue! I will refer you to this comment in this issue here. Storybook has always relied on the default project for Angular to get its build configuration, so the behaviour you experienced is not a bug, it's by design. So please, let me know if I can close this issue, if this makes sense! |
I've been fighting the same problem the last few weeks off and on, which made me unable to finalize my move to Angular 13 because of it. I've been meaning to open an issue, but just haven't gotten around to it (End of year tasks am I right ;D)
To go further on this, if you do set the
You'll see a similar error if you are try to pass in the
{
"storybook": {
"executor": "@nrwl/storybook:storybook",
//...
}
} to: {
"build": {
"executor": "@nrwl/storybook:storybook",
//...
}
}
Nevermind I realized you can just do:
I'm sure there is a less convoluted way to execute this though, but I wanted to document whatever I got working for any poor soul who runs into this ;D |
I recently had a similar issue. In the source code of Storybook I found a hint, that one can set an environment variable to set the Angular Project which would be used. Have you tried this out? https://storybook.js.org/docs/angular/configure/environment-variables Maybe creating a .env file inside the .storybook folder with the variable STORYBOOK_ANGULAR_PROJECT= could fix the issue? |
Hi all! Can I close this issue, since it's not really a bug? Thank you very much @bradtaniguchi for the detailed steps and fix, and thank you very much @pkirchniawy for the extra tip! Let me know if you try it out and it works, maybe we can try and add the functionality at some point? :) <3 |
So, to recap, yes, if you're on an Angular project working with Storybook and you're having trouble running Storybook, you can do the following: For buildable projectsThat means: for apps, buildable libs, projects that have the Run you app like this:
For non-buildable projectsOr for non buildable projects, projects that do NOT have the Run your app like this:
Notice how here we are explicitly passing the |
Would 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 |
I'm working on that doc, and a more helpful error 🙃 @nick-allen |
Linking this for reference #8255 |
In my setup (that worked a while ago but doesn't anymore), the build (for a non-buildable lib) fails because as I understand it, the
Adding the build app files by hand in the storybook Did you run into that in the setup above also, if not why? |
Does the projectBuildConfig flag only work for projects with projectType "library"? When providing the --projectBuildConfig flag to the library, it works. When I provide the flag to the application type, it does not change anything... I then changed the application type to the library type, and then it did change the angular project on build. |
@vincentB23 ! That's strange. I just tried it for an app, and it works for me. I removed the My app name is
and it got the Can you share with me the error you got in the console? |
@vincentB23 I had this setup and working as an application only, hadn't messed with a lib at all to this point, and was able to get it to run with just the |
Hi @qortex ! I see you solved the polyfill.js issue (storybookjs/storybook#16977 (comment)). I'll keep this open until we have a fix for that, too. |
Hi, I'm not sure, but I think you forgot one more case - @nrwl/storybook:cypress-project. We have cypress tests for storybook, and we just realized that storybook builds default application for some reason (it's not needed actually), and it started failing because of memory allocation error. How I can specify |
@qortex @vincentB23 @nick-allen Run your app like this:
Notice how here we are explicitly passing the |
@BOBRIWE can you please try above solution in a similar way, and let me know if it works? |
These are temporary workarounds, we'll come up with a concrete solution - either console suggestions, or something similar. |
I meant that we're running e2e tests and storybook like this: But I found solution, you need to pass "storybook": {
"builder": "@nrwl/storybook:storybook",
"options": {
"uiFramework": "@storybook/angular",
"port": 4400,
"config": {
"configFolder": "apps/storybook-app/.storybook"
},
// Here
"projectBuildConfig": "storybook-app:build-storybook"
},
"configurations": {
"ci": {
"quiet": true
}
}
}, |
I have this PR under way, we want to review it a bit more and make sure it makes sense in all scenarios. But the purpose would be to automatically use the current |
New docs for |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current 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 errorSee 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
The text was updated successfully, but these errors were encountered: