storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.62k stars 9.31k forks source link

Installation fails in an existing Angular 9 project #12232

Closed vadal closed 3 years ago

vadal commented 4 years ago

Describe the bug When I run npx sb init or npx -p @storybook/cli sb init in an existing angular 9 project, I get the following error: Cannot read property 'build' of undefined.

To Reproduce Steps to reproduce the behavior:

  1. Open terminal inside an angular9 project
  2. Run npx sb init or npx -p @storybook/cli sb init command

Expected behavior Installation succeeds

Screenshots

error

System: OS: macOS Mojave 10.14.6 CPU: (8) x64 Intel(R) Core(TM) i7-3635QM CPU @ 2.40GHz Binaries: Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node Yarn: 1.0.2 - /usr/local/bin/yarn npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm Browsers: Chrome: 84.0.4147.135 Firefox: 79.0 Safari: 13.1.2 npmGlobalPackages: @storybook/cli: 6.0.16

Additional context

Can you please help? I can't find any workaround.

vadal commented 4 years ago

Can please someone help? I haven't got an answer neither here nor in support chat. It seems that support team ignores my issue.

Marklb commented 4 years ago

Can you provide a repo that reproduces the issue? That error looks like your default project in angular.json does not have the build property at projects.default-project-name.architect.build.

Since no configuration details are provided, my best guess is that you are maybe using Nx? If that is the case, you may find steps to help here: https://nx.dev/angular/plugins/storybook/overview

JamboBuenna commented 4 years ago

Also getting the same issue. I followed the install on an Ionic Project and straight Angular project both on ng9. I did this initially using the standard tutorial & then also the tutorial here. I got the invalid hook calls errors other are getting, it seemed to be in this case the app wanted to instanciate React but no react instance was installed.

image

There were also a number more errors.

image

We're not using an nx repro.

vadal commented 4 years ago

@Marklb thank you for the answer. I don't use an nx repo either. I was able to make it work by adding the architect property in angular.json

stale[bot] commented 4 years ago

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

stale[bot] commented 3 years ago

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

shilman commented 3 years ago

Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.13 containing PR #13558 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease
shilman commented 3 years ago

Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.15 containing PR #13558 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade