nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.29k stars 2.32k forks source link

Integration with storybook: unable to resolve @nrwl/storybook:storybook #4516

Closed vic-lsh closed 3 years ago

vic-lsh commented 3 years ago

Current Behavior

When adding storybook to the nx-examples repository, I'm seeing the following error:

> nx run products:storybook
Unable to resolve @nrwl/storybook:storybook.
Cannot find module '@storybook/core/dist/server/build-dev'
Require stack:
- /Users/shihangli/dev/nx-examples/node_modules/@nrwl/storybook/src/builders/storybook/storybook.impl.js
- /Users/shihangli/dev/nx-examples/node_modules/@nrwl/tao/src/shared/workspace.js
- /Users/shihangli/dev/nx-examples/node_modules/@nrwl/tao/src/commands/run.js
- /Users/shihangli/dev/nx-examples/node_modules/@nrwl/tao/index.js
- /Users/shihangli/dev/nx-examples/node_modules/@nrwl/cli/lib/run-cli.js

Expected Behavior

The storybook dashboard should launch.

Steps to Reproduce

  1. git clone https://github.com/nrwl/nx-examples
  2. yarn add --dev @nrwl/storybook
  3. nx g @nrwl/angular:storybook-configuration products
  4. nx run products:storybook

Environment

Node : 14.15.1 OS : darwin x64 yarn : 1.22.5

nx : Not Found @nrwl/angular : 11.0.1-rc.0 @nrwl/cli : 11.0.1-rc.0 @nrwl/cypress : 11.0.1-rc.0 @nrwl/devkit : 11.0.1-rc.0 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 11.0.1-rc.0 @nrwl/linter : 11.0.1-rc.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : 11.0.1-rc.0 @nrwl/schematics : Not Found @nrwl/tao : 11.0.1-rc.0 @nrwl/web : 11.0.1-rc.0 @nrwl/workspace : 11.0.1-rc.0 typescript : 4.0.3

juristr commented 3 years ago

There's a deep-import being made in one of our packages which apparently changed. I'm going to look into this. Thx for reporting

juristr commented 3 years ago

So there are a couple of things. First the core-js package is outdated on the nx-examples repo which then creates a conflict with storybook (requiring v3) when it is compiled.

Apart from that, it seems that for some reason (which I'm still trying to investigate), the @storybook/core dependency hasn't been installed. It is a direct dependency of the @storybook/angular package, so it should be there.

@vic-lee are you able to reproduce this issue on a new nx workspace as well?

juristr commented 3 years ago

@vic-lee I'm going to close this issue since we're seeing this only on the nx-examples repository atm. No one else reported this and I cannot reproduce it on a new Nx workspace either.

For some reason the @storybook/core package which is a dependency of @storybook/angular doesn't get installed on nx-examples, which normally is the case. So if the error happens, manually installing @storybook/core fixes it.

Feel free to re-open the issue if you're able to reproduce it on other workspaces as well.

github-actions[bot] commented 1 year ago

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.