Ladvace / astro-bento-portfolio

Astro-bento-portfolio is a minimal bento-like (almost) single page portfolio website made in Astro
https://sparkly-speculoos-0c9197.netlify.app/
MIT License
152 stars 50 forks source link

Problems when deploy to Cloudflare Pages #4

Open akring opened 6 months ago

akring commented 6 months ago

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(),
    });
  2. run npm run build and get the following error:
    
    > astro-bento-portfolio@0.0.2 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.
Ladvace commented 6 months ago

I'll dig into it in the next days to fix it, I saw that this is related to the astro-icon package, if you remove it, it should work

also, use pnpm and not npm, I forgot to add it to the package json

Ladvace commented 5 months ago

sorry if I didn't reply, I've been busy, I'll try to fix it as soon as I have time, otherwise feel free to open a PR if you find a fix for it

dann-5m commented 3 months ago

Hi, still having this issue, is there an update?

Ladvace commented 3 months ago

I'm not getting this error anymore, are you using the last version (last commits)?

dann-5m commented 3 months ago

Hmm builds normal, however doesn't seem to want to deploy

Ladvace commented 3 months ago

could you send the build logs or the error?