admin管理员组

文章数量:1331689

I'm trying to deploy my Astro project on Vercel, but the build keeps failing with the same error message:

at Object.stat (node:fs:1582:16)
    at find (file:///vercel/path0/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:18384:2)
    at async loadTsconfigJsonForFile (file:///vercel/path0/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:19432:20)
    at async compileAstro (file:///vercel/path0/node_modules/astro/dist/vite-plugin-astro/compile.js:14:21)
    at async transform (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:19663:16)
Error: Command "astro build" exited with 1

Does someone has experience with this error. I think it must have something todo with the tsconfig.json file, but I'm not sure. My tsconfig.json file looks like this:

    {
  "extends": "astro/tsconfigs/strict",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    },
    "jsx": "react-jsx",
    "jsxImportSource": "react",
    "types": ["astro/client"],
    "moduleResolution": "node"
  },
  "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.astro"],
  "exclude": ["node_modules", "dist"]
}

My astro.config.mjs file looks like this:

import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import react from '@astrojs/react';
import vercel from '@astrojs/vercel/serverless';
import astroI18next from 'astro-i18next';
import { fileURLToPath } from 'url';

const __dirname = fileURLToPath(new URL('.', import.meta.url));

export default defineConfig({
  output: 'server',
  adapter: vercel({
    webAnalytics: {
      enabled: true,
    },
  }),
  integrations: [tailwind(), react(), astroI18next()],
  vite: {
    resolve: {
      alias: {
        '@': fileURLToPath(new URL('./src', import.meta.url)),
        '@components': fileURLToPath(new URL('./src/components', import.meta.url)),
        '@assets': fileURLToPath(new URL('./src/assets', import.meta.url)),
      },
    },
    optimizeDeps: {
      include: ['react', 'react-dom'],
    },
    build: {
      sourcemap: true,
    },
  },
});

My repository is at:

Thanks for your help,

Anthony

本文标签: astrojsAstro project fails to build on VercelStack Overflow