storybookjs / storybook

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

build-storybook fails #18655

Closed cmbirk closed 1 year ago

cmbirk commented 2 years ago

Describe the bug I've built a test repo to try out react-data-grid. I've included a link to my public repo in the reproduction steps below. Running start-storybook works correctly, but attempting to run build-storybook throws the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received null
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Module.require (node:internal/modules/cjs/loader:998:3)
    at require (node:internal/modules/cjs/helpers:102:18)
    at execMethod (.../react-data-grid-proto/.yarn/cache/jest-worker-npm-26.6.2-46cbcd449f-f9afa3b88e.zip/node_modules/jest-worker/build/workers/processChild.js:113:16)
    at process.messageListener (.../react-data-grid-proto/.yarn/cache/jest-worker-npm-26.6.2-46cbcd449f-f9afa3b88e.zip/node_modules/jest-worker/build/workers/processChild.js:46:7)
    at process.emit (node:events:390:28)
    at process.emit (.../react-data-grid-proto/.pnp.cjs:28493:25)
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21) {
  code: 'ERR_INVALID_ARG_TYPE'
}
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

without much information as to why this might be failing. I'm trying to publish to Chromatic and can't without building the static site files.

To Reproduce

  1. Clone https://github.com/CrossroadsCX/react-data-grid-proto
  2. Run yarn build-storybook

System

Environment Info:

  System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.13.1 - /private/var/folders/t_/8fk55_k5699cgkqdt_v_41mw0000gn/T/xfs-8fb15fb5/node
    Yarn: 3.2.1 - /private/var/folders/t_/8fk55_k5699cgkqdt_v_41mw0000gn/T/xfs-8fb15fb5/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Edge: 103.0.1264.44
    Firefox: 102.0
    Safari: 15.5
bryanjtc commented 2 years ago

I have the same error.

bryanjtc commented 2 years ago

Deleting yarn.lock and running yarn install fixed it for me.

cmbirk commented 2 years ago

Unfortunately I get the same error when trying that

cmbirk commented 2 years ago

Which version of yarn are you running? I'm worried it's an issue with yarn berry. There seems to be a lot of incompatibilities with it on other libraries

bryanjtc commented 2 years ago

3.2.1. I upgraded a project from v1 to v3. It was a long process, and I use storybook-vite-builder, so there were like 30+ issues with dependencies.

zhyd1997 commented 2 years ago

the repro repo above works for me:

gh repo clone CrossroadsCX/react-data-grid-proto
code react-data-grid-proto
yarn build-storybook

nothing break when building storybook:

Screen Shot 2022-07-14 at 12 38 57
jcamden commented 2 years ago

I'm having the same issue locally (including for the above repro repo). Interestingly, I do not see the errors when running build-storybook on a Github Actions host.

Environment Info (local):

  System:
    OS: macOS 12.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 14.18.0 - /private/var/folders/mv/b15pxg914psdh8tq3_5z5tzw0000gp/T/xfs-f0b4d8c2/node
    Yarn: 3.2.1 - /private/var/folders/mv/b15pxg914psdh8tq3_5z5tzw0000gp/T/xfs-f0b4d8c2/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 100.0.2
    Safari: 15.5

Ah, I was surprised to see Node 14.18.0 in this output. I thought I was using 16.16.0. I set Node to that version and ran build-storybook again, this time successfully :)

IanVS commented 1 year ago

I cloned the reproduction, removed yarn.lock, performed an install, and storybook built without error. I guess somehow you had a dependency mis-match. Let us know if you're still not able to solve after trying this. Keep in mind you'll need to remove both the yarn.lock and node_modules folder, or else new dependencies won't be resolved.