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

Problems when deploy to Cloudflare Pages #4

Open
akring opened this issue Jan 1, 2024 · 6 comments
Open

Problems when deploy to Cloudflare Pages #4

akring opened this issue Jan 1, 2024 · 6 comments

Comments

@akring
Copy link

akring commented Jan 1, 2024

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.

@Ladvace
Copy link
Owner

Ladvace commented Jan 1, 2024

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
Copy link
Owner

Ladvace commented Feb 3, 2024

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
Copy link

dann-5m commented Apr 9, 2024

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

@Ladvace
Copy link
Owner

Ladvace commented Apr 10, 2024

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

@dann-5m
Copy link

dann-5m commented Apr 10, 2024

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

@Ladvace
Copy link
Owner

Ladvace commented Apr 11, 2024

could you send the build logs or the error?

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

3 participants