dmtrKovalenko / odiff

The fastest pixel-by-pixel image visual difference tool in the world.
MIT License
2.03k stars 74 forks source link

Could not create _export folder: EEXIST: file already exists #68

Closed alvesvaren closed 2 weeks ago

alvesvaren commented 1 year ago

I've been using this with lost-pixel, and it gives me this error sometimes when I deploy to vercel and it uses the existing node_modules folder when reinstalling dependencies:

[14:52:43.956] [4/4] Building fresh packages...
[14:52:44.436] error /vercel/path0/node_modules/odiff-bin: Command failed.
[14:52:44.436] Exit code: 1
[14:52:44.437] Command: node ./postinstall.js
[14:52:44.437] Arguments: 
[14:52:44.437] Directory: /vercel/path0/node_modules/odiff-bin
[14:52:44.437] Output:
[14:52:44.437] Could not create _export folder
[14:52:44.438] error: Error: EEXIST: file already exists, mkdir '/vercel/path0/node_modules/odiff-bin/3'
[14:52:44.439] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[14:52:52.090] Error: Command "yarn install" exited with 1
dmtrKovalenko commented 1 year ago

That's unfair! I'll take a look into that ASAp

TrySound commented 1 year ago

Hi, having the same in vercel deploy. Something in their env?

Installed by yarn 1

dmtrKovalenko commented 1 year ago

The problem is in our install script which fails on fs exists.

What I can think of the following workaround – remove all the folders on preinstall script. E.g. preinstall: "rm -rf node-modules/odiff-bin"

dmtrKovalenko commented 1 year ago

I will work on several odiff fixes on thanksgiving weekends and will fix the issue

TrySound commented 1 year ago

Thanks!

alvesvaren commented 1 year ago

The workaround of adding "preinstall": "rm -rf node_modules/odiff-bin" to the script-section of package.json works for me, thanks

alvesvaren commented 1 year ago

I have upgraded to 2.5.1, but it still fails to install (exactly the same error).

I can replicate it locally by running yarn followed by yarn upgrade odiff-bin in my project directory.

The folder node_modules/odiff-bin/3 seems to be deleted when running yarn, but then when it runs yarn upgrade it tries to create the same folder again.

Folder structure in my node_modules when it fails: Screenshot_20221208_104623

It seems to fail once every other time I run yarn upgrade odiff-bin

nick-fields commented 1 year ago

FWIW, I started seeing this today in our Netlify builds and once locally. We're using lost-pixel@3.2.0 (which uses odiff-bin@2.5.0) and have been for a few weeks before seeing this for the first time.

dmtrKovalenko commented 1 year ago

Need to revisit that one, workaround should help. Remove node_modules/odiff before you do npm install on CI

nick-fields commented 1 year ago

The preinstall script wasn't enough for us for some reason. We use yarn, so pinning the version to 2.5.1 via the resolutions feature has worked so far

dmtrKovalenko commented 1 year ago

It would be very helpful if you can create isolated repository specifically for your issue so I can debug it

alvesvaren commented 1 year ago

I can replicate it by initializing an empty package with yarn init, running yarn add lost-pixel and then yarn upgrade odiff-bin. This causes the last command to fail every other time.

dmtrKovalenko commented 2 weeks ago

This should be totally resolved by the new build system