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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build - ENOENT on Mac, EPERM on Windows 馃槶 #4

Closed
patrickgrey opened this issue Mar 25, 2022 · 3 comments
Closed

Can't build - ENOENT on Mac, EPERM on Windows 馃槶 #4

patrickgrey opened this issue Mar 25, 2022 · 3 comments

Comments

@patrickgrey
Copy link

Hi, I can't get 11ty to build when the Vite plugin is included. I've created the most paired down example I can: https://github.com/patrickgrey/pg-11ty-vite-test-01

The repo will build without the vite plugin. Simply adding the plugin causes the build issues. I watched the release video but couldn't see the project structure to copy.

I'm using 11ty 2.0.0-canary.4 and vite plugin 1.0.0-canary.1

The development server works fine. When I build on Windows I get an EPERM error. When I build on Mac, I get an ENOENT error. The full error messages are in the README of the above test repo.

I'm wondering if there is some sort of race condition going on where vite and 11ty are trying to rename / access folders at the same time? Please let me know if there is any further testing I can do. Cheers.

@simplerethink
Copy link

@patrickgrey

Changing

<link rel="stylesheet" href="{{ './css/index.css' | url }}">

To

<link rel="stylesheet" href="{{ './css/index.css' }}">

Resolves the issue for me in my tests.

@patrickgrey
Copy link
Author

patrickgrey commented Apr 2, 2022

Thanks @simplerethink but I'm afraid this doesn't make any difference for me, at least on Windows. I'll test on Mac. The question anyway would be why this would solve things? Appreciate you testing. Cheers.

@patrickgrey
Copy link
Author

I finally took the time to look at the plugin code. I'm going to close this thread as the problem seems to be my environment and node so, nothing to do with 11ty. Basically trying fspromise.rename always results in an EPERM for me.

I understand most of the plugin code but one part has me stumped and I'd really appreciate an explanation if anyone has time.

EleventyVite.js has a runBuild method. Another directory is created to output the Vite build. I thought that the directory names were swapped so that build files end up in the expected 11ty output directory. It's the following code that confuses me:

await fsp.mkdir(tmp, { recursive: true });
await fsp.rename(this.outputDir, tmp);

Doesn't fsp.rename just change the name of outputDir to tmp and therefore overwrite the tmp dir? Does this somehow swap the names? I can't find an answer in node documentation. Sorry if I'm being ignorant here - I'm not experienced with node. Cheers, Patrick

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

No branches or pull requests

2 participants