cworld1 / astro-theme-pure

A simple, clean but powerful blog theme build by astro.
https://astro-theme-pure.vercel.app
Apache License 2.0
23 stars 5 forks source link

我想问问如何改成部署到 cloudflare #9

Closed king-zhangbn closed 2 days ago

king-zhangbn commented 2 weeks ago

我已经按照 Astro 的官方教程修改了 Astro.config import cloudflare from '@astrojs/cloudflare';

export default defineConfig({ output: 'server', adapter: cloudflare() });

并且删掉了之前的Vercel 的代码,但还是无法成功,可否帮帮孩纸

king-zhangbn commented 2 weeks ago

2024-10-13T14:24:06.767416Z Cloning repository... 2024-10-13T14:24:07.834464Z From https://github.com/king-zhangbn/ASTRO-BLOG-2024 2024-10-13T14:24:07.835061Z * branch cef03a2d54b8581df86c623ca9b6eaf90d43ee2c -> FETCH_HEAD 2024-10-13T14:24:07.835176Z 2024-10-13T14:24:07.94385Z HEAD is now at cef03a2 更新 astro.config.ts 2024-10-13T14:24:07.944333Z 2024-10-13T14:24:08.035405Z 2024-10-13T14:24:08.035915Z Using v2 root directory strategy 2024-10-13T14:24:08.060449Z Success: Finished cloning repository files 2024-10-13T14:24:09.664122Z Checking for configuration in a wrangler.toml configuration file (BETA) 2024-10-13T14:24:09.664933Z 2024-10-13T14:24:09.76279Z No wrangler.toml file found. Continuing. 2024-10-13T14:24:09.911684Z Detected the following tools from environment: bun@1.0.1, nodejs@18.17.1 2024-10-13T14:24:09.912457Z Installing project dependencies: bun install --frozen-lockfile 2024-10-13T14:24:10.14395Z bun install v1.0.1 (31aec4eb) 2024-10-13T14:24:13.735422Z + @playform/compress@0.1.0 2024-10-13T14:24:13.735781Z + @tailwindcss/aspect-ratio@0.4.2 2024-10-13T14:24:13.735916Z + @tailwindcss/typography@0.5.13 2024-10-13T14:24:13.736017Z + @types/dompurify@3.0.5 2024-10-13T14:24:13.736123Z + @types/markdown-it@14.1.1 2024-10-13T14:24:13.736308Z + @types/sanitize-html@2.11.0 2024-10-13T14:24:13.736478Z + @types/xmldom@0.1.34 2024-10-13T14:24:13.736659Z + @typescript-eslint/parser@7.15.0 2024-10-13T14:24:13.736792Z + eslint@8.57.0 2024-10-13T14:24:13.736909Z + eslint-plugin-astro@0.31.4 2024-10-13T14:24:13.737045Z + eslint-plugin-jsx-a11y@6.9.0 2024-10-13T14:24:13.737151Z + prettier@3.3.2 2024-10-13T14:24:13.737254Z + prettier-config-standard@7.0.0 2024-10-13T14:24:13.737352Z + prettier-plugin-astro@0.13.0 2024-10-13T14:24:13.737445Z + prettier-plugin-tailwindcss@0.5.14 2024-10-13T14:24:13.737578Z + @astrojs/check@0.7.0 2024-10-13T14:24:13.737821Z + @astrojs/mdx@3.1.2 2024-10-13T14:24:13.73797Z + @astrojs/node@8.3.2 2024-10-13T14:24:13.738082Z + @astrojs/rss@4.0.7 2024-10-13T14:24:13.73829Z + @astrojs/sitemap@3.1.6 2024-10-13T14:24:13.738378Z + @astrojs/tailwind@5.1.0 2024-10-13T14:24:13.738546Z + @astrojs/vercel@7.7.2 2024-10-13T14:24:13.738647Z + @vercel/analytics@1.3.1 2024-10-13T14:24:13.738788Z + @vercel/speed-insights@1.0.12 2024-10-13T14:24:13.738865Z + @waline/client@3.2.7 2024-10-13T14:24:13.739026Z + astro@4.12.2 2024-10-13T14:24:13.739107Z + astro-icon@1.1.0 2024-10-13T14:24:13.739165Z + clsx@2.1.1 2024-10-13T14:24:13.739226Z + dompurify@3.1.6 2024-10-13T14:24:13.739282Z + fuse.js@7.0.0 2024-10-13T14:24:13.739375Z + katex@0.16.11 2024-10-13T14:24:13.739491Z + markdown-it@14.1.0 2024-10-13T14:24:13.739613Z + mdast-util-to-string@4.0.0 2024-10-13T14:24:13.739724Z + node-html-parser@6.1.13 2024-10-13T14:24:13.739805Z + reading-time@1.5.0 2024-10-13T14:24:13.739874Z + rehype-external-links@3.0.0 2024-10-13T14:24:13.739987Z + rehype-katex@7.0.0 2024-10-13T14:24:13.740096Z + remark-github-blockquote-alert@1.2.1 2024-10-13T14:24:13.740201Z + remark-math@6.0.0 2024-10-13T14:24:13.740296Z + remark-rehype@11.1.0 2024-10-13T14:24:13.740434Z + remark-unwrap-images@4.0.0 2024-10-13T14:24:13.740584Z + sanitize-html@2.13.0 2024-10-13T14:24:13.740847Z + sharp@0.33.4 2024-10-13T14:24:13.741165Z + tailwind-merge@2.3.0 2024-10-13T14:24:13.741248Z + tailwindcss@3.4.4 2024-10-13T14:24:13.741471Z + typescript@5.5.3 2024-10-13T14:24:13.741733Z + unist-util-visit@5.0.0 2024-10-13T14:24:13.741832Z + xmldom@0.6.0 2024-10-13T14:24:13.742065Z 2024-10-13T14:24:13.742154Z 925 packages installed [3.60s] 2024-10-13T14:24:13.751698Z Executing user command: npm run build 2024-10-13T14:24:14.495081Z 2024-10-13T14:24:14.495355Z > astro-blog@0.0.1 build 2024-10-13T14:24:14.495472Z > astro check && astro build 2024-10-13T14:24:14.495585Z 2024-10-13T14:24:14.98157Z /opt/buildhome/repo/node_modules/ansi-align/index.js:3 2024-10-13T14:24:14.982179Z const stringWidth = require('string-width') 2024-10-13T14:24:14.982595Z ^ 2024-10-13T14:24:14.982703Z 2024-10-13T14:24:14.982814Z Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/buildhome/repo/node_modules/string-width/index.js from /opt/buildhome/repo/node_modules/ansi-align/index.js not supported. 2024-10-13T14:24:14.983264Z Instead change the require of /opt/buildhome/repo/node_modules/string-width/index.js in /opt/buildhome/repo/node_modules/ansi-align/index.js to a dynamic import() which is available in all CommonJS modules. 2024-10-13T14:24:14.983839Z at Object. (/opt/buildhome/repo/node_modules/ansi-align/index.js:3:21) { 2024-10-13T14:24:14.983928Z code: 'ERR_REQUIRE_ESM' 2024-10-13T14:24:14.984285Z } 2024-10-13T14:24:14.984599Z 2024-10-13T14:24:14.984682Z Node.js v18.17.1 2024-10-13T14:24:14.998191Z Failed: Error while executing user command. Exited with error code: 1 2024-10-13T14:24:15.007062Z Failed: build command exited with code: 1 2024-10-13T14:24:16.037809Z Failed: error occurred while running build command 这是报错 modules/ansi-align/index.js not supported. emmmm

king-zhangbn commented 2 days ago

https://blog.en.icu/blog/2024-10-25astro-pure主题部署到cloudflare/

已解决