astro-bento-portfolio icon indicating copy to clipboard operation
astro-bento-portfolio copied to clipboard

Problems when deploy to Cloudflare Pages

Open akring opened this issue 6 months ago • 6 comments

Thank you for your great template!

I have a trouble when I tried to deploy it to Cloudflare Pages, here is my process and problems:

  1. run npx astro add cloudflare to add cloudflare support, and the astro.config.mjs is automaticaly change to:
export default defineConfig({
  ...
  output: "server",
  adapter: cloudflare(),
});
  1. run npm run build and get the following error:
> [email protected] build
> astro build

01:39:12 [WARN] [@astrojs/cloudflare] The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice
01:39:12 Types generated 183ms
01:39:12 [build] output: "server"
01:39:12 [build] directory: /Users/xxx/Developer/Frontend/akring-astro-home/dist/
01:39:12 [build] adapter: @astrojs/cloudflare
01:39:12 [build] Collecting build info...
01:39:12 [build] ✓ Completed in 329ms.
01:39:12 [build] Building server entrypoints...
node:internal/fs/promises:628
  return new FileHandle(await PromisePrototypeThen(
                        ^

Error: ENOENT: no such file or directory, open '/Users/xxx/Developer/Frontend/akring-astro-home/dist/_astro/constants.x3V3ZnQq.js'
    at async open (node:internal/fs/promises:628:25)
    at async Object.readFile (node:internal/fs/promises:1228:14)
    at async extractFile (file:///Users/xxx/Developer/Frontend/akring-astro-home/node_modules/@unocss/vite/dist/index.mjs:334:20)
    at async Promise.all (index 2)
    at async setupContentExtractor (file:///Users/xxx/Developer/Frontend/akring-astro-home/node_modules/@unocss/vite/dist/index.mjs:358:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/xxx/Developer/Frontend/akring-astro-home/dist/_astro/constants.x3V3ZnQq.js'
}

Wish you can help me to deploy this great template to Cloudflare.

akring avatar Jan 01 '24 17:01 akring