下一个js vercel部署失败:TypeError:无法读取未定义的属性(读取'entryCSSFiles')

问题描述 投票:0回答:1

我的 vercel 部署总是因以下错误消息而失败,尝试到处搜索但未能找到根本原因以及如何修复它...我的本地环境我能够运行开发和构建(有时,这也是奇怪)成功了,卡在 vercel 部署上,需要有人帮助我,谢谢!

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'entryCSSFiles')
    at r_ (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:127:5173)
    at J.preloadCallbacks (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:127:7837)
    at rj (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:127:8824)
    at /mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:127:6849
    at /mypath/Desktop/dev/interview-cat/node_modules/next/dist/server/lib/trace/tracer.js:171:36
    at NoopContextManager.with (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)
    at ContextAPI.with (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)
    at NoopTracer.startActiveSpan (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18093)
    at ProxyTracer.startActiveSpan (/mypath/Desktop/dev/interview-cat/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18854)
    at /mypath/Desktop/dev/interview-cat/node_modules/next/dist/server/lib/trace/tracer.js:153:103
Export encountered an error on /(router)/page: /, exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null

相关文件/(router)/page,我在app/globals.css下只有一个css文件

import ChallengeSection from '@/app/components/home/ChallengeSection';
import AdvantageSection from '@/app/components/home/AdvantageSection';
import ServicesSection from '@/app/components/home/ServicesSection';
import HeroSection from '@/app/components/home/HeroSection';
import TestimonialsSection from '@/app/components/home/TestmonialsSection';
import CTASection from '@/app/components/home/CTASection';
import Navbar from '@/app/components/navigation/NavBar';

export default function HomePage() {
  return (
    <main className="min-h-screen">
      <Navbar />
      <HeroSection />
      <ChallengeSection />
      <AdvantageSection />
      <ServicesSection />
      <TestimonialsSection />
      <CTASection />
    </main>
  );
}

下一个.config.ts

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
};

export default nextConfig;

目录树

enter image description here

css reactjs typescript next.js vercel
1个回答
0
投票

在阅读了 nextjs 官方文档几个小时后,我发现根本原因是路由器,我更改了路由器页面以与 nextjs 文档保持一致,问题得到了解决。

© www.soinside.com 2019 - 2024. All rights reserved.