Skip to content
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

[Bug]: Build fails in vue-docgen-plugin due to wrongly resolved node_modules path #29533

Open
simonvizzini opened this issue Nov 4, 2024 · 0 comments

Comments

@simonvizzini
Copy link

simonvizzini commented Nov 4, 2024

Describe the bug

Our Storybook build is currently failing with an vue-docgen-api error. The error occurs only on our CI pipeline (Azure DevOps with a self-hosted Linux agent). Locally (on Windows) the build works fine. Unfortunately I have no way to test this on a local Linux machine, due to company policies only Windows is allowed.

Here is the error output from our CI:

> [email protected] build:storybook /apps/azdo-agent/agent3/_work/116/s
> storybook build --loglevel silly

@storybook/core v8.3.6

info => Cleaning outputDir: storybook-static
info => Loading presets
info => Building manager..
info => Manager built (139 ms)
info => Building preview..
info => Copying static files: public at storybook-static
vite v5.4.10 building for production...
transforming...
✓ 123 modules transformed.
x Build failed in 1.56s
=> Failed to build the preview
[storybook:vue-docgen-plugin] ENOENT: no such file or directory, open '../../../../node_modules/vue-component-library/dist/components/index.js'
file: ./src/modules/the-vue-app/components/form-inputs/OptionsFormField.vue
    at Object.readFileSync (node:fs:448:20)
    at getTypeDefinitionFromIdentifierFromModule (./node_modules/vue-docgen-api/src/script-setup-handlers/utils/tsUtils.ts:38:7)
    at Context.visitImportSpecifier (./node_modules/vue-docgen-api/src/script-setup-handlers/utils/tsUtils.ts:86:16)
    at Context.invokeVisitorMethod (./node_modules/ast-types/lib/path-visitor.js:283:51)
    at PVp.visitWithoutReset (./node_modules/ast-types/lib/path-visitor.js:158:32)
    at NodePath.each (./node_modules/ast-types/lib/path.js:88:26)
    at visitChildren (./node_modules/ast-types/lib/path-visitor.js:179:18)
    at PVp.visitWithoutReset (./node_modules/ast-types/lib/path-visitor.js:167:20)
    at visitChildren (./node_modules/ast-types/lib/path-visitor.js:204:25)
    at PVp.visitWithoutReset (./node_modules/ast-types/lib/path-visitor.js:167:20)

The module vue-component-library is our own private library that we just published to a private Nexus repository. We added this library to our first Vue application for the first time, and that's when the error started to occur on our CI. So it must be somehow related to our module, maybe we didn't setup our library build right.

The strange thing is that the relative path is off by one level. Somehow it is trying to import from ./src/node_modules instead of ./node_modules

Reproduction link

Reproduction steps

Unfortunately I can't provide a reproduction, since the error only happens after integrating our own Vue component library as a node modules dependency. The module is private and I'm not allowed to share it.

System

Storybook Environment Info:

  System:
    OS: Windows 11 10.0.22621
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
  Binaries:
    Node: 20.16.0 - W:\app\tools\node-v20\node.EXE
    npm: 10.8.1 - W:\app\tools\node-v20\npm.CMD
    pnpm: 9.9.0 - W:\app\tools\node-v20\pnpm.CMD <----- active
  Browsers:
    Edge: Chromium (129.0.2792.89)
  npmPackages:
    @storybook/addon-essentials: 8.3.6 => 8.3.6
    @storybook/addon-interactions: 8.3.6 => 8.3.6
    @storybook/addon-links: 8.3.6 => 8.3.6
    @storybook/blocks: 8.3.6 => 8.3.6
    @storybook/cli: 8.3.6 => 8.3.6
    @storybook/manager-api: 8.3.6 => 8.3.6
    @storybook/test: 8.3.6 => 8.3.6
    @storybook/theming: 8.3.6 => 8.3.6
    @storybook/vue3: 8.3.6 => 8.3.6
    @storybook/vue3-vite: 8.3.6 => 8.3.6
    msw-storybook-addon: 2.0.3 => 2.0.3
    storybook: 8.3.6 => 8.3.6

Additional context

There is at least one more person with the exact same issue in the Discussion forums: #29158 (comment)

Initially I reported this issue in the vue-docgen-api Repo, as I wasn't sure where this path to node_modules is getting resolved. One of the maintainer replied and suggested that it might be an issue with how Storybook calls the library. See the response here: vue-styleguidist/vue-styleguidist#1691 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants