nx: Storybook run fail on workspace basing on workspace.json instead of angular.json due to lack of some config entries

Current Behavior

Workspace has only workspace.json file (no angular.json)

> nx run swo-ng-checkbox-wrapper:storybook
info => Loading presets
info => Loading 1 config file in "/Users/krzysztoforkiszswo/dev/orkisz/ng-react-mix-nx/libs/swo-ng/checkbox-wrapper/.storybook"
info => Loading 8 other files in "/Users/krzysztoforkiszswo/dev/orkisz/ng-react-mix-nx/libs/swo-ng/checkbox-wrapper/.storybook"
info => Adding stories defined in "/Users/krzysztoforkiszswo/dev/orkisz/ng-react-mix-nx/libs/swo-ng/checkbox-wrapper/.storybook/main.js"
info => Found custom tsconfig.json
info => Using implicit CSS loaders
info => Loading angular-cli config
info => Using angular project "swo-ng-progress-bar:build" for configuring Storybook
ERR! => Could not get angular cli webpack config
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined


          Broken build, fix the error above.
          You may need to refresh the browser.


———————————————————————————————————————————————

>  NX   ERROR  Running target "swo-ng-checkbox-wrapper:storybook" failed

  Failed tasks:

  - swo-ng-checkbox-wrapper:storybook

  Hint: run the command with --verbose for more details.

Take a look that it also tries to invoke default project build, not those I’m interested in

Expected Behavior

Storybook runs normally

Steps to Reproduce

In this commit I added some necessary props to workspace.json: https://github.com/orkisz/ng-react-mix-nx/tree/b5d28bcde242041267debdede95c9698034d5c91 just checking out previous commit will show the error. I assume Storybook integration needs info that exists in angular.json (tsConfig and angularBrowserTarget) but because of some convention is not necessary for NX

Failure Logs

Environment

Node : 14.17.6 OS : darwin x64 yarn : 1.22.11

nx : 12.9.0 @nrwl/angular : 12.9.0 @nrwl/cli : 12.9.0 @nrwl/cypress : 12.9.0 @nrwl/devkit : 12.9.0 @nrwl/eslint-plugin-nx : 12.9.0 @nrwl/express : Not Found @nrwl/jest : 12.9.0 @nrwl/linter : 12.9.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : 12.9.0 @nrwl/nx-cloud : Not Found @nrwl/react : 12.9.0 @nrwl/schematics : Not Found @nrwl/tao : 12.9.0 @nrwl/web : 12.9.0 @nrwl/workspace : 12.9.0 @nrwl/storybook : 12.9.0 @nrwl/gatsby : Not Found typescript : 4.3.5

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 16 (5 by maintainers)

Most upvoted comments

@junekpavel thanks, will have a look 👍

Hey @juristr and others, I’m having exactly same issue.

After some investigations, I found out, the issue isn’t probably related to workspace.json file name, but rather to the buildable libraries.

I prepared the repo with minimal reproduction https://github.com/junekpavel/nx-sb-demo, including all commands I run to generate it. Notice the --buildable flags when generating libraries - if you run generate libraries without them, the storybook is working.

Hello. I also have the same issue on NX 13.

And i found a strange thing. nx run project-name:storybook will take the first project from workspace.json -> projects

Screenshot 2021-10-28 at 15 43 52

You can see, that Running target "ngx-input:storybook" failed. But, at the top of this - Using angular project "commitlint-config:build" for configuring Storybook

P.S. I think, that the orkisz have the same issues. Because, on the screenshoot which he send, you can find the same issue. ERROR Running target "swo-ng-checkbox-wrapper:storybook" failed but Using angular project "swo-ng-progress-bar:build"

I’ve just migrated to 13. Issue still exists