question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storybook executors cannot find config files in certain cases

See original GitHub issue

Current Behavior

The @nrwl/storybook:* executors allow for specifying the options.config object (which allows for defining configFolder, configPath, srcRoot, and pluginPath). When used in a target, running nx <target> <project-name> will look for the paths defined in those configs, relative to where the command was run.

Example

libs/mylib/project.json snippet

{
  "targets": {
    "executor": "@nrwl/storybook:storybook",
    "options": {
      "config": {
        "configFolder": "libs/mylib/.storybook"
      }
    }
  }
}

Will yield the following results:

pwd
# outputs: /absolute/path/.../my-monorepo

nx serve mylib
# looks for the config file located at: /absolute/path/.../my-monorepo/libs/mylib/.storybook

cd libs/mylib
pwd
# outputs: /absolute/path/.../my-monorepo/libs/mylib

nx serve mylib
# looks for the config file located at: /absolute/path/.../my-monorepo/libs/mylib/libs/mylib/.storybook

This behavior is inconsistent with most repository-based tooling, as well as with other @nrwl executors, like Jest.

Expected Behavior

I expect to be able to run the Storybook-based targets/executors from any directory in the monorepo and have the configuration file resolve correctly with the same project.json file snippet provided above. Ideally, there would need to be no changes to my project.json file (to avoid breaking others’ projects).

Steps to Reproduce

Failure Logs

> nx run mylib:serve --verbose
ENOENT: no such file or directory, stat 'libs/mylib/.storybook'
Error: ENOENT: no such file or directory, stat 'libs/mylib/.storybook'
    at statSync (node:fs:1527:3)
    at findOrCreateConfig (/Users/imyourmanzi/monorepo/node_modules/@nrwl/storybook/src/utils/utilities.js:106:50)
    at resolveCommonStorybookOptionMapper (/Users/imyourmanzi/monorepo/node_modules/@nrwl/storybook/src/executors/utils.js:119:64)
    at storybookOptionMapper (/Users/imyourmanzi/monorepo/node_modules/@nrwl/storybook/src/executors/storybook/storybook.impl.js:59:140)
    at storybookExecutor_1 (/Users/imyourmanzi/monorepo/node_modules/@nrwl/storybook/src/executors/storybook/storybook.impl.js:12:24)
    at storybookExecutor_1.next (<anonymous>)
    at resume (/Users/imyourmanzi/monorepo/node_modules/tslib/tslib.js:225:48)
    at fulfill (/Users/imyourmanzi/monorepo/node_modules/tslib/tslib.js:227:35)

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

>  NX   ERROR  Running target "mylib:serve" failed

Environment

  Node : 16.1.0
  OS   : darwin x64
  npm  : 7.11.2

  nx : 13.4.6
  @nrwl/angular : undefined
  @nrwl/cli : 13.4.6
  @nrwl/cypress : 13.4.6
  @nrwl/devkit : 13.4.6
  @nrwl/eslint-plugin-nx : 13.4.6
  @nrwl/express : undefined
  @nrwl/jest : 13.4.6
  @nrwl/linter : 13.4.6
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : undefined
  @nrwl/nx-cloud : undefined
  @nrwl/react : 13.4.6
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.4.6
  @nrwl/web : 13.4.6
  @nrwl/workspace : 13.4.6
  @nrwl/storybook : 13.4.6
  @nrwl/gatsby : undefined
  typescript : 4.5.5
  rxjs : 6.6.7
  ---------------------------------------
  Community plugins:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mandarinicommented, Feb 25, 2022

Hi @imyourmanzi ! Thank you so much for filing an issue and providing a PR that solves it, too! I am reviewing your PR now, make sure all works as expected! πŸ˜ƒ

0reactions
mandarinicommented, Jul 18, 2022

Closing this for now! Let me know if we need to reopen!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading to Storybook 6 (and Nx versions >10.1.x and <14.0.0)
Use case 2: I already have an Nx workspace that does NOT use Storybook and I ... It will generate new Storybook configuration...
Read more >
Test your Storybook. Storybook for Angular - Medium
Can't run because no spec files were found.We searched for any files inside of this folder:...\apps\storybook-e2e\src\integration.
Read more >
Apache HBase β„’ Reference Guide
The Apache HBase team assumes no responsibility for your HBase clusters, your configuration, or your data. Supported. In the context of Apache HBase,...
Read more >
Glossary of United States Probate Terms - FamilySearch
(See case file or probate estate papers.) Executor (-trix) - The person (executor = male; executrix = female) who has been named by...
Read more >
No test found. Make sure that installed test discoverers ...
I am getting the following error: No test found. Make sure that installed test discoverers & executors, platform & framework version settings ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found