storybookjs / storybook

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

staticDirs config fails on ci/cd pipeline ([Error: EEXIST: file already exists, mkdir /builds/dist/storybook/stories/assets) #18686

Open dean-g opened 2 years ago

dean-g commented 2 years ago

My story book is failing with the following error after I moved my asset to staticDirs,

staticDirs: [
    { from: '../../../src/assets', to: 'assets' },
  ],

info => Using angular project with "tsConfig:/builds/libs/stories/.storybook/tsconfig.json"
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^
[Error: EEXIST: file already exists, mkdir '/builds/dist/storybook/stories/assets'] {
  errno: -17,
  code: 'EEXIST',
  syscall: 'mkdir',
  path: '/builds/dist/storybook/stories/assets'
}

storybook version is: "@nrwl/storybook": "14.3.6",

Is there a way to copy the file instead of mkdir ?

Please advise

mandarini commented 2 years ago

I believe that this is not an issue with Nx, since Nx is invoking the @storybook/angular builder directly, this is the reason why I suggested to @dean-g to open the issue here, on the Storybook repo, instead. @shilman do you see anything that may suggest what the problem may be? Or any tips on how I could help??

mlegait commented 2 years ago

Hello 👋

I was also wondering if it could be possible not to fail if the directory already exists. I would like to be able to do something like that:

staticDirs: [
  {from: './assets', to: 'assets/'},
  {from: '../../static-conf/common/icons/tails', to: 'assets/icons/tails'} ,
  {from: '../../static-conf/common/icons/common', to: 'assets/icons/all'},
  {from: '../../static-conf/taer/icons/custom', to: 'assets/icons/all'},
]

It works quite well when I launch Storybook locally but as soon as I want to build it in order to deploy it, it fails because of the error @dean-g mentioned above: Error: EEXIST: file already exists, mkdir ...

Being able to do that would be really helpful for the project I'm working on 😄

lucas-labs commented 1 year ago

Same error here.

staticDirs: [
  {
    from: "./../assets",
    to: "assets/"
  },
  {
    from: "./../node_modules/@internal/icon-font",
    to: "assets/fonts"
  }
]

It works ok while serving it locally, but fails when trying to build

[Error: EEXIST: file already exists, mkdir '[REDACTED]/dist/storybook/ds/assets']

nodesmichael commented 1 year ago

Same

zenby commented 1 year ago

Have the same issue

MadebyAe commented 1 year ago

Same... Any work around?

zenby commented 1 year ago

Same... Any work around?

bump storybook to 7th version

duhem-s commented 1 year ago

Same... Any work around?

bump storybook to 7th version

I did try to upgrade to version 7 but for other reasons my storybook is not working anymore.

There is no way to fix this in version 6 ?