Getting a permissions error when deploying Astro site to CF Pages

I’m trying to deploy an Astro site to Cloudflare pages, but I’m consistently getting this error:

“EACCES: permission denied, scandir ‘/root’”

It’s happening after the build appears to complete successfully:

Has anyone seen this before and have any idea what might be happening?

1 Like

Can you share your Astro config? Do you have it configured to be using /root for anything?

I am having the same issue since a few minutes ago, tried building a few times. My Astro config didn’t change and building and deploying worked before.

Here’s my astro.config.mjs

import mdx from '@astrojs/mdx'
import sitemap from '@astrojs/sitemap'
import compress from 'astro-compress'
import { defineConfig } from 'astro/config'
import { readingTime } from './src/functions/reading-time'
export default defineConfig({
  site: '',
  compressHTML: true,
  build: { inlineStylesheets: 'always' },
  vite: {
    ssr: {
      noExternal: ['astro', '@igor.dvlpr/astro-post-excerpt']
  markdown: {
    remarkPlugins: [readingTime],
    shikiConfig: {
      theme: 'dracula',
      wrap: true
  integrations: [
      HTML: {
        caseSensitive: true,
        collapseBooleanAttributes: true,
        collapseInlineTagWhitespace: false,
        collapseWhitespace: true,
        html5: true,
        keepClosingSlash: false,
        minifyCSS: true,
        minifyJS: true,
        noNewlinesBeforeTagClose: true,
        removeAttributeQuotes: false,
        removeComments: true,
        removeScriptTypeAttributes: false,
        removeStyleLinkTypeAttributes: true,
        removeTagWhitespace: false,
        sortAttributes: false,
        sortClassName: true,
        useShortDoctype: true
      CSS: {
        restructure: true
      JavaScript: {
        compress: true,
        format: { comments: false }
    mdx({ shikiConfig: { theme: 'one-dark-pro', wrap: true } }),

It’s the astro-compress plugin! I tracked it down to a minor version bump. Locking it at the pervious version fixed it for me. Give that a shot.

1 Like

Specifically, v2.1.3 of astro-compress broke it for me. And it wasn’t just on CF Pages. My site was also deploying to Vercel and it stopped working there too.

1 Like

You should make an issue on their GitHub if you haven’t already :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.