gobblejs/gobble

Gobble grab EEXIST symlink error

Opened this issue · 5 comments

I'm not sure if this is actually a Gobble issue, but it's my best guess at the moment. I have a gobblefile that runs fine locally (on Windows). I'm deploying to Heroku, and the same gobblefile exits with an error midway through:

gobble: build started
gobble: 09-moveTo done in 8ms
gobble: 01-babel done in 372ms
∙∙∙∙∙∙∙ 10-grab running...
gobble: 10-grab transformation failed

input:  /app/.gobble-build/01-babel/1
output: /app/.gobble-build/10-grab/1
>>>
EEXIST, symlink '/app/.gobble-build/10-grab/1'
Error: EEXIST, symlink '/app/.gobble-build/10-grab/1'
    at Error (native)
<<<

It strikes me as ... wrong. If I look at the .gobble-build directory on heroku, there is an empty /10-grab/1 directory. On my local machine, that step goes fine and the 10-grab/1 directory contains a js file.

Might this be a gobble issue, or is it more likely to be caused by something else?

EDIT:

If I remove the grab step, things work fine. It looks like this could be coming from sander's symlinkOrCopy method, which has different behavior for windows.

Yeah I'm running into the same issue. I can't seem to use .grab like the documentation says:

Grab all the files in the specified subdirectory. For example, if src/assets were a directory with an images subdirectory, you could do this:

assets = gobble( 'src/assets' );
images = assets.grab( 'images' );
images would now contain the contents of src/assets/images.

At least not on Linux.

I can confirm that this is a grab issue (at least on the Gobble side of things) and still present on gobble@0.10.2.

For anyone who comes across this, a quick fix is to just build a custom transform that uses some other module to copy over contents from target input dir to the output dir.

This is still an issue.

I'll try setting up a unit test for this and have a look.

FWIW and as far as I can tell by reading the source code, the problem seems to be that gobble first creates the output directory and then tries to sander.symlinkOrCopy() using this just created directory as the target. Which results in an error since the directory already exists.

I'm just guessing but it seems to me that the tricky thing is that gobble always creates the outputdir (in Node.ready()) before running the transform.
But in the case of the grabtransform, the transform itself tries to create the outputdir. And this results in an error since the directory already exists.

@IvanSanchez , there's now a test case for this added by @TrySound but it's currently disabled.

Still experiencing the same issues with grab on macOS and Linux. Not happening in Windows tho.