Nextjs15-无法在当地构建项目?

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

我想在本地构建应用程序,但我不能总是相同的:


Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
    at nF ...
Export encountered an error on /_not-found/page: /_not-found, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null

node -v
v22.11.0
{
  "name": "",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@gsap/react": "^2.1.2",
    "@strapi/blocks-react-renderer": "^1.0.2",
    "gsap": "^3.12.7",
    "leaflet": "^1.9.4",
    "lenis": "^1.2.3",
    "next": "^15.2.2",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-leaflet": "^5.0.0",
    "swiper": "^11.2.5",
    "yet-another-react-lightbox": "^3.21.8"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3",
    "@svgr/webpack": "^8.1.0",
    "@tailwindcss/postcss": "^4",
    "@types/leaflet": "^1.9.16",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "eslint": "^9",
    "eslint-config-next": "15.2.2",
    "tailwindcss": "^4",
    "typescript": "^5"
  }
}

在app的根中,我没有发现的。tsx

reactjs next.js build
1个回答
0
投票

当您在页面级别使用复合组件时,就会发生这种情况。因为Next.js仅在应用程序/页面目录中查找页面,并且如果您在页面中创建了任何UI组件并导出它,那么您将获得此错误。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.