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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11ty gives EPERM error when trying to rename _site to .11ty-vite #22

Closed
haid0109 opened this issue Jan 19, 2023 · 24 comments
Closed

11ty gives EPERM error when trying to rename _site to .11ty-vite #22

haid0109 opened this issue Jan 19, 2023 · 24 comments

Comments

@haid0109
Copy link

haid0109 commented Jan 19, 2023

setup: windows 10, eleventy v2.0.0-beta.1, Node v16.14.1, vscode v1.74.3

code in .eleventy.js:

const vitePlugin = require("@11ty/eleventy-plugin-vite");

module.exports = function(eleventyConfig) {
    eleventyConfig.addPlugin(vitePlugin);

    eleventyConfig.setTemplateFormats([ "ejs" ]);
    eleventyConfig.setEjsOptions({ async: true });

    eleventyConfig.addPassthroughCopy("css");
    eleventyConfig.addPassthroughCopy("*.html");
    eleventyConfig.addPassthroughCopy("*.jpg");
    eleventyConfig.addPassthroughCopy("*.webp");
    eleventyConfig.addPassthroughCopy("*.png");
    eleventyConfig.addPassthroughCopy("components/*.svelte");
    eleventyConfig.addPassthroughCopy("scripts");
};

output of running build:

$ npm run build-eleventy

> [email protected] build-eleventy
> eleventy

[11ty] Warning: Eleventy Plugin (@11ty/eleventy-plugin-vite) Compatibility: This project requires the Eleventy version to match '>=2.0.0-canary.4' but found 2.0.0-beta.1. Use `npm update @11ty/eleventy -g` to upgrade the eleventy global or `npm update @11ty/eleventy --save` to upgrade your local project version.
[11ty] Writing _site/index.html from ./index.html.ejs
[11ty] Writing _site/password-reset.html from ./password-reset.html.ejs
[11ty] Writing _site/401.html from ./401.html.ejs
[11ty] Writing _site/accept-invite.html from ./accept-invite.html.ejs
[11ty] Writing _site/feed.html from ./feed.html.ejs
[11ty] Writing _site/organizations.html from ./organizations.html.ejs
[11ty] Writing _site/groups.html from ./groups.ejs
[11ty] Writing _site/permissions.html from ./permissions.html.ejs
[11ty] Writing _site/profile.html from ./profile.html.ejs
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] EPERM: operation not permitted, rename 'C:\Users\haid0\repos\bunch.social-frontend\_site' -> 'C:\Users\haid0\repos\bunch.social-frontend\.11ty-vite' (via Error)
[11ty]
[11ty] Original error stack trace: Error: EPERM: operation not permitted, rename 'C:\Users\haid0\repos\bunch.social-frontend\_site' -> 
'C:\Users\haid0\repos\bunch.social-frontend\.11ty-vite'
[11ty] Copied 22 files / Wrote 9 files in 0.12 seconds (v2.0.0-beta.1)

running 11ty in debug mode does not give any more useful info for solving the problem:

debug mode output logs
$ DEBUG=Eleventy* npm run build-eleventy

> [email protected] build-eleventy
> eleventy

Eleventy:cmd command: eleventy { _: [], quiet: null, version: false, watch: false, dryrun: false, help: false, serve: false, incremental: false, 'ignore-initial': false } +0ms
Eleventy:EventBus Setting up global EventBus. +0ms
Eleventy:UserConfig Resetting EleventyConfig to initial values. +0ms
Eleventy:UserConfig Adding universal filter 'slug' +25ms
Eleventy:UserConfig Adding universal filter 'slugify' +1ms
Eleventy:UserConfig Adding universal filter 'url' +1ms
Eleventy:UserConfig Adding universal filter 'log' +0ms
Eleventy:UserConfig Adding universal filter 'serverlessUrl' +0ms
Eleventy:UserConfig Adding universal filter 'getCollectionItemIndex' +1ms
Eleventy:UserConfig Adding universal filter 'getCollectionItem' +0ms
Eleventy:UserConfig Adding universal filter 'getPreviousCollectionItem' +1ms
Eleventy:UserConfig Adding universal filter 'getNextCollectionItem' +0ms
Eleventy:TemplateConfig rootConfig { templateFormats: [ 'liquid',   'ejs', 'md',       'hbs', 'mustache', 'haml', 'pug',      'njk', 
'html',     '11ty.js' ], pathPrefix: '/', markdownTemplateEngine: 'liquid', htmlTemplateEngine: 'liquid', htmlOutputSuffix: '-o', dataFileSuffixes: [ '.11tydata', '' ], dataFileDirBaseNameOverride: false, keys: { package: 'pkg', layout: 'layout', permalink: 'permalink', permalinkRoot: 'permalinkBypassOutputDir', engineOverride: 'templateEngineOverride', computed: 'eleventyComputed' }, dir: { input: '.', includes: '_includes', data: '_data', output: '_site' }, handlebarsHelpers: {}, nunjucksFilters: {} } +0ms
Eleventy Setting process.env.ELEVENTY_ROOT: 'C:/Users/haid0/repos/bunch.social-frontend' +0ms
Eleventy:TemplateConfig Merging config with .eleventy.js +6ms
Eleventy:UserConfig Adding anonymous plugin +110ms
[11ty] Warning: Eleventy Plugin (@11ty/eleventy-plugin-vite) Compatibility: This project requires the Eleventy version to match '>=2.0.0-canary.4' but found 2.0.0-beta.1. Use `npm update @11ty/eleventy -g` to upgrade the eleventy global or `npm update @11ty/eleventy --save` to upgrade your local project version.
Eleventy:TemplateConfig overrides: {} +110ms
Eleventy:TemplateConfig Current configuration: { pathPrefix: '/', markdownTemplateEngine: 'liquid', htmlTemplateEngine: 'liquid', htmlOutputSuffix: '-o', dataFileSuffixes: [ '.11tydata', '' ], dataFileDirBaseNameOverride: false, keys: { package: 'pkg', layout: 'layout', permalink: 'permalink', permalinkRoot: 'permalinkBypassOutputDir', engineOverride: 'templateEngineOverride', computed: 'eleventyComputed' }, dir: { input: '.', includes: '_includes', data: '_data', output: '_site' }, handlebarsHelpers: { slug: [Function (anonymous)], slugify: [Function (anonymous)], url: [Function (anonymous)], log: [Function (anonymous)], serverlessUrl: [Function (anonymous)], getCollectionItemIndex: [Function (anonymous)], getCollectionItem: [Function (anonymous)], getPreviousCollectionItem: [Function (anonymous)], getNextCollectionItem: [Function (anonymous)] }, nunjucksFilters: { slug: [Function (anonymous)], slugify: [Function (anonymous)], url: [Function (anonymous)], log: [Function (anonymous)], serverlessUrl: [Function (anonymous)], getCollectionItemIndex: [Function (anonymous)], getCollectionItem: [Function (anonymous)], getPreviousCollectionItem: [Function (anonymous)], getNextCollectionItem: [Function (anonymous)] }, transforms: {}, linters: {}, globalData: {}, layoutAliases: {}, layoutResolution: true, passthroughCopies: { css: { outputPath: true, copyOptions: {} }, '*.html': { outputPath: true, copyOptions: {} }, '*.jpg': { outputPath: true, copyOptions: {} }, '*.webp': { outputPath: true, copyOptions: {} }, '*.png': { outputPath: true, copyOptions: {} }, 'components/*.svelte': { outputPath: true, copyOptions: {} }, scripts: { outputPath: true, copyOptions: {} }, 'public/**': { outputPath: '/', copyOptions: {} } }, liquidOptions: {}, liquidTags: {}, liquidFilters: { slug: [Function (anonymous)], slugify: [Function (anonymous)], url: [Function (anonymous)], log: [Function (anonymous)], serverlessUrl: [Function (anonymous)], getCollectionItemIndex: [Function (anonymous)], getCollectionItem: [Function (anonymous)], getPreviousCollectionItem: [Function (anonymous)], getNextCollectionItem: [Function (anonymous)] }, liquidShortcodes: {}, liquidPairedShortcodes: {}, nunjucksEnvironmentOptions: {}, nunjucksPrecompiledTemplates: {}, nunjucksAsyncFilters: {}, nunjucksTags: {}, nunjucksGlobals: {}, nunjucksAsyncShortcodes: {}, nunjucksShortcodes: {}, nunjucksAsyncPairedShortcodes: {}, nunjucksPairedShortcodes: {}, handlebarsShortcodes: {}, handlebarsPairedShortcodes: {}, javascriptFunctions: { slug: [Function (anonymous)], slugify: [Function (anonymous)], url: [Function (anonymous)], log: [Function (anonymous)], serverlessUrl: [Function (anonymous)], getCollectionItemIndex: [Function (anonymous)], getCollectionItem: [Function (anonymous)], getPreviousCollectionItem: [Function (anonymous)], getNextCollectionItem: [Function (anonymous)] }, pugOptions: {}, ejsOptions: { async: true }, markdownHighlighter: null, libraryOverrides: {}, 
dynamicPermalinks: true, useGitIgnore: true, ignores: Set(4) { '**/node_modules/**', '.git/**', 'public', '.11ty-vite\\**' }, watchIgnores: Set(2) { '**/node_modules/**', '.git/**' }, dataDeepMerge: true, watchJavaScriptDependencies: true, additionalWatchTargets: [], serverOptions: { module: '@11ty/eleventy-dev-server', showVersion: true, setup: [AsyncFunction: setup] }, chokidarConfig: {}, watchThrottleWaitTime: 0, frontMatterParsingOptions: undefined, dataExtensions: Map(0) {}, extensionMap: Set(0) {}, quietMode: false, events: AsyncEventEmitter { _events: [Object: null prototype] { 'eleventy.after': [AsyncFunction (anonymous)] }, _eventsCount: 1, _maxListeners: undefined, [Symbol(kCapture)]: false }, benchmarkManager: BenchmarkManager { benchmarkGroups: { Configuration: [BenchmarkGroup], Aggregate: [BenchmarkGroup] }, isVerbose: true, start: 447.49210000038147 }, plugins: [ { plugin: [Function (anonymous)], options: undefined, pluginNamespace: '' } ], useTemplateCache: true, precompiledCollections: {}, dataFilterSelectors: Set(0) {}, libraryAmendments: {}, serverPassthroughCopyBehavior: 'copy', urlTransforms: [], templateFormats: [ 'ejs' ] } +0ms
Eleventy Eleventy warm up time (in ms) 603.3587999939919 +122ms
Eleventy:TemplatePassthroughManager Resetting counts to 0 +0ms
Eleventy:EleventyFiles .gitignore,.eleventyignore,.eleventyignore ignoring: ./node_modules/** +0ms
Eleventy:EleventyFiles .gitignore,.eleventyignore,.eleventyignore ignoring: ./_site/** +1ms
Eleventy:EleventyFiles .gitignore,.eleventyignore,.eleventyignore ignoring: ./dist +0ms
Eleventy:EleventyFiles .gitignore,.eleventyignore,.eleventyignore ignoring: ./components/*.js +0ms
Eleventy:EleventyFiles .gitignore,.eleventyignore,.eleventyignore ignoring: ./components/*.js.map +1ms
Eleventy Directories:
Eleventy Input (Dir): .
Eleventy Input (File): undefined
Eleventy Data: _data
Eleventy Includes: _includes
Eleventy Layouts: undefined
Eleventy Output: _site
Eleventy Template Formats: ejs
Eleventy Verbose Output: false +12ms
Eleventy:EleventyFiles Searching for: [ './**/*.ejs' ] +5ms
Eleventy:FastGlobManager Glob search ('templates') searching for: [ './**/*.ejs' ] +0ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copy started. +31ms
Eleventy:TemplatePassthroughManager `addPassthroughCopy` config API paths: { css: { outputPath: true, copyOptions: {} }, '*.html': { 
outputPath: true, copyOptions: {} }, '*.jpg': { outputPath: true, copyOptions: {} }, '*.webp': { outputPath: true, copyOptions: {} }, '*.png': { outputPath: true, copyOptions: {} }, 'components/*.svelte': { outputPath: true, copyOptions: {} }, scripts: { outputPath: true, copyOptions: {} }, 'public/**': { outputPath: '/', copyOptions: {} } } +0ms
Eleventy:TemplatePassthroughManager `addPassthroughCopy` config API normalized paths: [ { inputPath: './css', outputPath: true, copyOptions: {} }, { inputPath: './*.html', outputPath: true, copyOptions: {} }, { inputPath: './*.jpg', outputPath: true, copyOptions: {} }, { inputPath: './*.webp', outputPath: true, copyOptions: {} }, { inputPath: './*.png', outputPath: true, copyOptions: {} }, { inputPath: './components/*.svelte', outputPath: true, copyOptions: {} }, { inputPath: './scripts', outputPath: true, copyOptions: {} }, { inputPath: './public/**', outputPath: '/', copyOptions: {} } ] +2ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './css', outputPath: true, copyOptions: {} 
} +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './*.html', outputPath: true, copyOptions: 
{} } +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './*.jpg', outputPath: true, copyOptions: {} } +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './*.webp', outputPath: true, copyOptions: 
{} } +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './*.png', outputPath: true, copyOptions: {} } +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './components/*.svelte', outputPath: true, 
copyOptions: {} } +0ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './scripts', outputPath: true, copyOptions: {} } +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copying from config: { inputPath: './public/**', outputPath: '/', copyOptions: {} } +0ms
Eleventy:TemplatePassthrough Copying './css' +0ms
Eleventy:TemplatePassthrough Copying './*.html' +1ms
Eleventy:TemplatePassthrough Searching for: './*.html' +1ms
Eleventy:FastGlobManager Glob search ('passthrough') searching for: './*.html' +33ms
Eleventy:TemplatePassthrough Copying './*.jpg' +2ms
Eleventy:TemplatePassthrough Searching for: './*.jpg' +0ms
Eleventy:FastGlobManager Glob search ('passthrough') searching for: './*.jpg' +3ms
Eleventy:TemplatePassthrough Copying './*.webp' +1ms
Eleventy:TemplatePassthrough Searching for: './*.webp' +1ms
Eleventy:FastGlobManager Glob search ('passthrough') searching for: './*.webp' +1ms
Eleventy:TemplatePassthrough Copying './*.png' +1ms
Eleventy:TemplatePassthrough Searching for: './*.png' +1ms
Eleventy:FastGlobManager Glob search ('passthrough') searching for: './*.png' +2ms
Eleventy:TemplatePassthrough Copying './components/*.svelte' +2ms
Eleventy:TemplatePassthrough Searching for: './components/*.svelte' +0ms
Eleventy:FastGlobManager Glob search ('passthrough') searching for: './components/*.svelte' +3ms
Eleventy:TemplatePassthrough Copying './scripts' +3ms
Eleventy:TemplatePassthrough Copying './public/**' +1ms
Eleventy:TemplatePassthrough Searching for: './public/**' +0ms
Eleventy:FastGlobManager Glob search ('passthrough') searching for: './public/**' +4ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +0ms
Eleventy:TemplateData getLocalDataPaths('./401.html.ejs'): [ './401.html.11tydata.js', './401.html.11tydata.cjs', './401.html.11tydata.json', './401.html.json' ] +0ms
Eleventy:TemplateWriter ./401.html.ejs adding to template map. +0ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +2ms
Eleventy:TemplateData getLocalDataPaths('./accept-invite.html.ejs'): [ './accept-invite.html.11tydata.js', './accept-invite.html.11tydata.cjs', './accept-invite.html.11tydata.json', './accept-invite.html.json' ] +0ms
Eleventy:TemplateWriter ./accept-invite.html.ejs adding to template map. +2ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./feed.html.ejs'): [ './feed.html.11tydata.js', './feed.html.11tydata.cjs', './feed.html.11tydata.json', './feed.html.json' ] +1ms
Eleventy:TemplateWriter ./feed.html.ejs adding to template map. +2ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./groups.ejs'): [ './groups.11tydata.js', './groups.11tydata.cjs', './groups.11tydata.json', './groups.json' ] +0ms
Eleventy:TemplateWriter ./groups.ejs adding to template map. +1ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./index.html.ejs'): [ './index.html.11tydata.js', './index.html.11tydata.cjs', './index.html.11tydata.json', './index.html.json' ] +0ms
Eleventy:TemplateWriter ./index.html.ejs adding to template map. +1ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./organizations.html.ejs'): [ './organizations.html.11tydata.js', './organizations.html.11tydata.cjs', './organizations.html.11tydata.json', './organizations.html.json' ] +1ms
Eleventy:TemplateWriter ./organizations.html.ejs adding to template map. +1ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./password-reset.html.ejs'): [ './password-reset.html.11tydata.js', './password-reset.html.11tydata.cjs', './password-reset.html.11tydata.json', './password-reset.html.json' ] +0ms
Eleventy:TemplateWriter ./password-reset.html.ejs adding to template map. +2ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./permissions.html.ejs'): [ './permissions.html.11tydata.js', './permissions.html.11tydata.cjs', './permissions.html.11tydata.json', './permissions.html.json' ] +1ms
Eleventy:TemplateWriter ./permissions.html.ejs adding to template map. +1ms
Eleventy:TemplateData Using [ '.11tydata', '' ] suffixes to find data files. +1ms
Eleventy:TemplateData getLocalDataPaths('./profile.html.ejs'): [ './profile.html.11tydata.js', './profile.html.11tydata.cjs', './profile.html.11tydata.json', './profile.html.json' ] +0ms
Eleventy:TemplateWriter ./profile.html.ejs adding to template map. +1ms
Eleventy:FastGlobManager Glob search ('global-data') searching for: [ './_data/**/*.{json,cjs,js}' ] +23ms
Eleventy:TemplatePassthroughManager Skipped copying './*.jpg' (emulated passthrough copy) +43ms
Eleventy:TemplatePassthroughManager Skipped copying './*.webp' (emulated passthrough copy) +1ms
Eleventy:TemplatePassthroughManager Skipped copying './public/**' (emulated passthrough copy) +1ms
Eleventy:TemplatePassthrough Copying individual file 'bell.png' +60ms
Eleventy:TemplatePassthrough Copying individual file 'components\\Authentication.svelte' +0ms
Eleventy:TemplatePassthrough Copying individual file '404.html' +1ms
Eleventy:TemplatePassthrough Copying individual file 'paperclip.png' +0ms
Eleventy:TemplatePassthrough Copying individual file 'magnify.png' +1ms
Eleventy:TemplatePassthrough Copying individual file 'components\\Groups.svelte' +1ms
Eleventy:TemplatePassthrough Copying individual file 'components\\Login.svelte' +1ms
Eleventy:TemplatePassthrough Copying individual file 'components\\EditProfileForm.svelte' +2ms
Eleventy:TemplatePassthrough Copying individual file 'components\\MessageCard.svelte' +0ms
Eleventy:TemplatePassthrough Copying individual file 'components\\Notification.svelte' +1ms
Eleventy:TemplatePassthrough Copying individual file 'components\\NotificationTray.svelte' +0ms
Eleventy:TemplatePassthrough Copying individual file 'components\\Organizations.svelte' +1ms
Eleventy:TemplatePassthrough Copying individual file 'components\\PasswordReset.svelte' +0ms
Eleventy:TemplatePassthrough Copying individual file 'components\\ProcessInvite.svelte' +0ms
Eleventy:TemplatePassthrough Copying individual file 'components\\Signup.svelte' +1ms
Eleventy:TemplatePassthrough Copying individual file 'css\\style.css' +1ms
Eleventy:TemplatePassthrough Copying individual file 'components\\UserInviteForm.svelte' +0ms
Eleventy:TemplatePassthrough Copying individual file 'scripts\\permissionsUtils.js' +1ms
Eleventy:TemplatePassthrough Copying individual file 'scripts\\login.js' +1ms
Eleventy:TemplatePassthrough Copying individual file 'scripts\\requireOrgFromUrl.js' +0ms
Eleventy:TemplatePassthrough Copying individual file 'scripts\\tokenUtils.js' +1ms
Eleventy:TemplatePassthrough Copying individual file 'scripts\\refreshAuthToken.js' +0ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './401.html.ejs' of 2022-12-08T14:16:28.153Z (from 1670508988153.4639) +0ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './groups.ejs' of 2022-10-31T11:59:25.874Z (from 1667217565874.428) +1ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './index.html.ejs' of 2022-08-30T09:09:30.407Z (from 1661850570407.764) +1ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './feed.html.ejs' of 2022-08-30T09:09:30.407Z (from 1661850570407.764) +0ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './accept-invite.html.ejs' of 2022-10-28T12:23:45.167Z (from 1666959825167.12) +1ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './password-reset.html.ejs' of 2022-09-19T10:42:21.154Z (from 1663584141154.9824) +1ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './organizations.html.ejs' of 2022-11-15T15:11:16.696Z (from 1668525076696.4438) +1ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './permissions.html.ejs' of 2022-10-28T12:23:45.181Z (from 1666959825181.12) +0ms
Eleventy:Template Template date: using file’s 'birthtimeMs' for './profile.html.ejs' of 2022-11-10T14:49:21.884Z (from 1668091761884.7878) +1ms
Eleventy:TemplateMap Caching collections objects. +0ms
Eleventy:Template Rendering permalink for './401.html.ejs': /401.html becomes '/401.html' +5ms
Eleventy:Template Rendering permalink for './groups.ejs': /groups.html becomes '/groups.html' +2ms
Eleventy:Template Rendering permalink for './index.html.ejs': /index.html becomes '/index.html' +1ms
Eleventy:Template Rendering permalink for './feed.html.ejs': /feed.html becomes '/feed.html' +0ms
Eleventy:Template Rendering permalink for './accept-invite.html.ejs': /accept-invite.html becomes '/accept-invite.html' +1ms
Eleventy:Template Rendering permalink for './password-reset.html.ejs': /password-reset.html becomes '/password-reset.html' +1ms      
Eleventy:Template Rendering permalink for './organizations.html.ejs': /organizations.html becomes '/organizations.html' +1ms
Eleventy:Template Rendering permalink for './permissions.html.ejs': /permissions.html becomes '/permissions.html' +1ms
Eleventy:Template Rendering permalink for './profile.html.ejs': /profile.html becomes '/profile.html' +1ms
Eleventy:TemplateMap Collection: collections.all size: 9 +13ms
Eleventy:TemplateMap Collection: collections.all size: 9 +0ms
Eleventy:TemplateWriter Template map created. +95ms
Eleventy:Logger Writing _site/index.html from ./index.html.ejs +0ms
Eleventy:Logger Writing _site/password-reset.html from ./password-reset.html.ejs +0ms
Eleventy:Logger Writing _site/401.html from ./401.html.ejs +1ms
Eleventy:Logger Writing _site/groups.html from ./groups.ejs +1ms
Eleventy:Logger Writing _site/feed.html from ./feed.html.ejs +1ms
Eleventy:Logger Writing _site/accept-invite.html from ./accept-invite.html.ejs +0ms
Eleventy:Logger Writing _site/organizations.html from ./organizations.html.ejs +1ms
Eleventy:Logger Writing _site/permissions.html from ./permissions.html.ejs +0ms
Eleventy:Logger Writing _site/profile.html from ./profile.html.ejs +1ms
Eleventy:TemplatePassthroughManager Copied './*.html' (1 files) +113ms
Eleventy:TemplatePassthroughManager Copied './*.png' (3 files) +0ms
Eleventy:TemplatePassthroughManager Copied './components/*.svelte' (12 files) +3ms
Eleventy:TemplatePassthroughManager Copied './css' (1 files) +0ms
Eleventy:TemplatePassthroughManager Copied './scripts' (5 files) +1ms
Eleventy:TemplatePassthroughManager TemplatePassthrough copy finished. Current count: 22 +2ms
Eleventy:Template _site/index.html written.. +42ms
Eleventy:Template _site/password-reset.html written.. +0ms
Eleventy:Template _site/401.html written.. +1ms
Eleventy:Template _site/groups.html written.. +0ms
Eleventy:Template _site/feed.html written.. +0ms
Eleventy:Template _site/accept-invite.html written.. +1ms
Eleventy:Template _site/organizations.html written.. +0ms
Eleventy:Template _site/profile.html written.. +0ms
Eleventy:Template _site/permissions.html written.. +0ms
[11ty] Problem writing Eleventy templates:
[11ty] EPERM: operation not permitted, rename 'C:\Users\haid0\repos\bunch.social-frontend\_site' -> 'C:\Users\haid0\repos\bunch.social-frontend\.11ty-vite' (via Error)
Eleventy:EleventyErrorHandler (error stack): Error: EPERM: operation not permitted, rename 'C:\Users\haid0\repos\bunch.social-frontend\_site' -> 'C:\Users\haid0\repos\bunch.social-frontend\.11ty-vite' +0ms
Eleventy:Benchmark Benchmark      7ms   2%     1× (Aggregate) Configuration addPlugin +0ms
Eleventy:Benchmark Benchmark     21ms   6%     1× (Aggregate) Searching the file system (templates) +1ms
Eleventy:Logger Benchmark     43ms  12%     6× (Aggregate) Searching the file system (passthrough) +27ms
Eleventy:Benchmark Benchmark     43ms  12%     6× (Aggregate) Searching the file system (passthrough) +0ms
Eleventy:Benchmark Benchmark     10ms   3%     1× (Aggregate) Searching the file system (data) +1ms
Eleventy:Logger Benchmark     41ms  11%    10× (Aggregate) Template Read +1ms
Eleventy:Benchmark Benchmark     41ms  11%    10× (Aggregate) Template Read +0ms
Eleventy:Logger Benchmark     86ms  23%    22× (Aggregate) Passthrough Copy File +1ms
Eleventy:Benchmark Benchmark     86ms  23%    22× (Aggregate) Passthrough Copy File +1ms
Eleventy:Benchmark Benchmark      0ms   0%     9× (Aggregate) (count) getOutputLocations +0ms
Eleventy:Benchmark Benchmark      0ms   0%     9× (Aggregate) (count) Render Permalink +1ms
Eleventy:Benchmark Benchmark      7ms   2%    19× (Aggregate) Template Compile +0ms
Eleventy:Benchmark Benchmark      2ms   0%     2× (Aggregate) > Compile > ./401.html.ejs +0ms
Eleventy:Benchmark Benchmark      1ms   0%    18× (Aggregate) Render +1ms
Eleventy:Benchmark Benchmark     26ms   7%     9× (Aggregate) Template Write +0ms
[11ty] Copied 22 files / Wrote 9 files in 0.22 seconds (v2.0.0-beta.1)
Eleventy Finished writing templates. +210ms
Eleventy 
Eleventy       Getting frustrated? Have a suggestion/feature request/feedback?
Eleventy       I want to hear it! Open an issue: https://github.com/11ty/eleventy/issues/new +1ms

I've tried running terminal in admin, closing vscode and opening it again, clearing vscode cache (as per recommendations online), to no avail.
Seems like a problem with the vite plugin.

@zachleat
Copy link
Member

Hmm, do you have a repo to reproduce? I did just try to reproduce unsuccessfully on Windows with @11ty/[email protected] and @11ty/[email protected]

@aarongoldenthal
Copy link

I have the same issue, although with a custom output directory, specifically with this project (branch 52-minify-content). I've tried with @11ty/eleventy v2.0.0-beta.1 and v2.0.0-beta.2, with @11ty/eleventy-plugin-vite v4.0.0 and v2.0.0-canary.3.

Running on Linux, e.g. this CI job, the build runs as expected.

@zachleat
Copy link
Member

@aarongoldenthal I filed your issue at #23, with a few workarounds there.

@aarongoldenthal
Copy link

aarongoldenthal commented Jan 28, 2023

Thanks @zachleat. Looking at the plugin code I can see the potential problem with "public", although in my case I think I also have the issue here. Setting output: "_site" I get exactly the same error as above (also tried changing the viteOptions.publicDir and get the original error).

Looking more closely, the plugin is failing here, and it appears to be due to nodejs/node#29481. I do get successful results with the same config on Linux.

My config:

  • Windows 10, version21H2
  • Node: 18.13.0
  • This occurs when run in a PowerShell windows in VSCode, or in a a standalone PowerShell window (I was curious if some other VSCode process was holding files/folders open).

@aarongoldenthal
Copy link

To see if it made a difference, I checked a few other configurations:

  • Windows 11 version 22H2, with different antivirus
  • Tried both machines with antivirus disabled

...but got the same results.

@kalininmax
Copy link

@zachleat The same error. My try to set up eleventy and vite-plugin https://github.com/kalininmax/eleventy-starter
image
Windows 10 21H2
Node: 19.6.0
npm: 9.4.1

I can start dev server with npx @11ty/eleventy --serve --quiet --incremental but can't build with npx @11ty/eleventy (screenshot). How to fix it?

@haid0109
Copy link
Author

haid0109 commented Feb 8, 2023

@zachleat Sorry for the late response, I have created a test repo to reproduce the error here: https://github.com/haid0109/test-11ty-vite-plugin

Running npx @11ty/eleventy with the --serve option seems to run successfully, even with other options like --watch attached to it (as hinted at by @kalininmax), but omitting the --serve option produces the same error described in the issue description.

@sknoslo
Copy link

sknoslo commented Mar 9, 2023

I'm also experiencing this issue on Windows. Looking at the node documentation for rename, I'm surprised that it is only an issue on Windows, and apparently not for everyone. The documentation states that "if there is a directory at newPath, an error will be raised", and the preceding line clearly creates that directory, so it seems like it should always cause an error. I'm able to work around it by altering the plugin to rm the temporary path if it already exists, prior to the rename.

@anantakrishna
Copy link

Looking at the node documentation for rename, I'm surprised that it is only an issue on Windows, and apparently not for everyone. The documentation states that "if there is a directory at newPath, an error will be raised", and the preceding line clearly creates that directory, so it seems like it should always cause an error.

A good description of how the current behavior on Windows doesn't match the documentation: nodejs/node#21957 (comment). That issue is closed as addressed in nodejs/node@e7ca398, though surprisingly the revised documentation still doesn't explain the current behavior properly. At the same time, more appropriate nodejs/node#22014 was closed.

Anyhow, here we need to deal with the current behavior on Windows, which is not documented as of now.

I'm able to work around it by altering the plugin to rm the temporary path if it already exists, prior to the rename.

This workaround works like a charm. @zachleat would you mind if I send a PR?

@geealbers
Copy link

We're experiencing the same issue on our project.

"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-plugin-vite": "^4.0.0",

Would be great to get a PR in to fix the issue. In the meantime, @anantakrishna, would you mind sharing the specific code you used for the workaround? I tried creating it myself after seeing @sknoslo's comment, but was having trouble getting it to work. (Admittedly, I'm not really a regular js developer so am a little out of my depth here.)

@anantakrishna
Copy link

would you mind sharing the specific code you used for the workaround?

In node_modules\@11ty\eleventy-plugin-vite\EleventyVite.js:

  async runBuild(input) {
    let tmp = path.resolve(".", this.options.tempFolderName);

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

It's worth noting that the same EPERM error occasionally occurs even after this fix but due to another reason. When I open some file from the output folder in VSCode, it locks the whole directory, and further remove/rename fails. The lock stays even after you close the file. Only VSCode restart helps. But it's easy to avoid if you know this quirk.

Besides this, I had to change a bit further down the method.

      viteOptions.build.rollupOptions.input = input
        .filter(entry => !!entry.outputPath) // filter out `false` serverless routes
        .filter(entry => (entry.outputPath || "").endsWith(".html")) // only html output
        .map(entry => {
-         if(!entry.outputPath.startsWith(this.outputDir + path.sep)) {
+         if(!entry.outputPath.startsWith(this.outputDir + '/')) {
            throw new Error(`Unexpected output path (was not in output directory ${this.outputDir}): ${entry.outputPath}`);
          }

In my experience, entry.outputPath uses forward slashes even on Windows, therefore the condition would always produce false with path.sep. I'll raise a separate issue regarding this.

@geealbers
Copy link

Thank you @anantakrishna! That fix worked for me, though I also had to change path.sep to / as you did.

@anantakrishna
Copy link

In my experience, entry.outputPath uses forward slashes even on Windows, therefore the condition would always produce false with path.sep.

There is a confirmation for this in the Eleventy repo: https://github.com/11ty/eleventy/blob/8e88b0786b4330182020dd0a7bc602ff774869f6/src/TemplatePermalink.js#L194

    return normalize(outputDir + "/" + uri);

Thus, the path is combined using a forward slash, and not the path.sep. The normalize function from https://github.com/jonschlinkert/normalize-path is meant to “Normalize slashes in a file path to be posix/unix-like forward slashes.” Therefore, platform-specific separator cannot appear there even on Windows.

I hope that I don't miss anything.

@1619digital
Copy link

Hi, I've created a pull request for this issue and for #35 building on @anantakrishna . In particular we need to catch the Vite build error case without throwing another directory rename error, and I use path.normalize to ensure the correct path separator is checked.

@anantakrishna
Copy link

Thanks, @1619digital. I wonder where's Zach…

@SleeplessByte
Copy link

Here is the patch-package until it's fixed upstream:

diff --git a/node_modules/@11ty/eleventy-plugin-vite/EleventyVite.js b/node_modules/@11ty/eleventy-plugin-vite/EleventyVite.js
index cb546a0..5e785ad 100644
--- a/node_modules/@11ty/eleventy-plugin-vite/EleventyVite.js
+++ b/node_modules/@11ty/eleventy-plugin-vite/EleventyVite.js
@@ -49,7 +49,10 @@ class EleventyVite {
     let tmp = path.resolve(".", this.options.tempFolderName);
 
     await fsp.mkdir(tmp, { recursive: true });
-    await fsp.rename(this.outputDir, tmp);
+
+    // see https://github.com/11ty/eleventy-plugin-vite/issues/22#issuecomment-1539443517
+    await fsp.cp(this.outputDir, tmp, { recursive: true });
+    await fsp.rm(this.outputDir, { recursive: true });
 
     try {
       let viteOptions = lodashMerge({}, this.options.viteOptions);
@@ -59,11 +62,13 @@ class EleventyVite {
         .filter(entry => !!entry.outputPath) // filter out `false` serverless routes
         .filter(entry => (entry.outputPath || "").endsWith(".html")) // only html output
         .map(entry => {
-          if(!entry.outputPath.startsWith(this.outputDir + path.sep)) {
+          // see https://github.com/11ty/eleventy/blob/8e88b0786b4330182020dd0a7bc602ff774869f6/src/TemplatePermalink.js#L194
+          //
+          if(!entry.outputPath.startsWith(this.outputDir + '/')) {
             throw new Error(`Unexpected output path (was not in output directory ${this.outputDir}): ${entry.outputPath}`);
           }
 
-          return path.resolve(tmp, entry.outputPath.substr(this.outputDir.length + path.sep.length));
+          return path.resolve(tmp, entry.outputPath.substr(this.outputDir.length + '/'.length));
         });
 
       viteOptions.build.outDir = path.resolve(".", this.outputDir);
@@ -71,7 +76,9 @@ class EleventyVite {
       await buildVite(viteOptions);
     } catch(e) {
       console.warn( `[11ty] Encountered a Vite build error, restoring original Eleventy output to ${this.outputDir}`, e );
-      await fsp.rename(tmp, this.outputDir);
+      // see https://github.com/11ty/eleventy-plugin-vite/issues/22#issuecomment-1539443517
+      await fsp.cp(tmp, this.outputDir, { recursive: true });
+      await fsp.rm(tmp, { recursive: true });
       throw e;
     } finally {
       // remove the tmp dir

@gericci
Copy link

gericci commented Sep 27, 2023

HI! I'm having the same error using Eleventy 2.0.1 and eleventy-plugin-vite 4.0.0. (I see the MR is still on wait)

EPERM: operation not permitted, rename 'C:\PROJECTS\CNSA-FR.11ty-vite' -> 'C:\PROJECTS\CNSA-FR_site' (via Error)
[11ty]
[11ty] Original error stack trace: Error: EPERM: operation not permitted, rename 'C:\PROJECTS\CNSA-FR.11ty-vite' -> 'C:\PROJECTS\CNSA-FR_site'

@TomSinclair
Copy link

Still running in to this issue

@SleeplessByte
Copy link

My patch still works

@KiwiKilian
Copy link
Contributor

KiwiKilian commented Jun 27, 2024

If anybody here is up to upgrading to Eleventy v3 and checking out the latest alpha release of this plugin to test, if this bug still exists on Windows, would be awesome. Find the latest docs on the alpha branch and let me know if I can assist.

If upgrading is not currently possible for you, it would also be helpful if you clone this repos alpha branch and run npm run example and npm run example:start to test if it works at all on Windows.

@anantakrishna
Copy link

I'm not ready to switch right now, but as soon as I do, will report back. Thank you for your efforts!

@KiwiKilian
Copy link
Contributor

KiwiKilian commented Jul 2, 2024

@anantakrishna if you just have a few minutes you could try the example. If you have Node 18 or higher installed, just clone this repos' alpha branch and run:

npm install
npm run example

Now you can check if the project builds successfully.

npm run example:start

Now you can check if development server runs.

@anantakrishna
Copy link

Done it. Seems all is fine. At least no issues in the console.

PS C:\Users\akd\source\repos\eleventy-plugin-vite> npm run example:start

> @11ty/[email protected] example:start
> npm run example -- --serve


> @11ty/[email protected] example
> npx @11ty/eleventy --config=example/.eleventy.js --input=example --output=example/_site --serve

[11ty] Writing ./example/_site/index.html from ./example/index.njk
[11ty] Copied 1 file / Wrote 1 file in 0.62 seconds (v3.0.0-alpha.6)
[11ty] Watching…
[11ty] Server at http://localhost:8080/

@KiwiKilian
Copy link
Contributor

Awesome, thank you!

Happy to hear more reports.

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

Successfully merging a pull request may close this issue.