• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Next.js 게시판 npm run build 오류

npm run build 오류

4 글 보임 - 1 에서 4 까지 (총 4 중에서)
  • 글쓴이
  • #114257

    김환진
    참가자
    hanaro@DESKTOP-B653UTJ MINGW64 /d/learning/NextJS/forum (main)
    $ npm run build
    > forum@0.1.0 build
    > next build
       ▲ Next.js 14.1.0
       - Environments: .env
       Creating an optimized production build ...
     ✓ Compiled successfully
     ✓ Linting and checking validity of types    
       Collecting page data  ...ReferenceError: options is not defined
        at 32623 (D:\learning\NextJS\forum\.next\server\app\_not-found.js:1:4461)
        at t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at 39883 (D:\learning\NextJS\forum\.next\server\app\_not-found.js:1:3431)
        at Function.t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async collectGenerateParams (D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:919:21)
        at async D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1138:17
        at async Span.traceAsyncFn (D:\learning\NextJS\forum\node_modules\next\dist\trace\trace.js:151:20)
    ReferenceError: options is not defined
        at 32623 (D:\learning\NextJS\forum\.next\server\app\edit\[id]\page.js:1:5499)
        at t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at 39883 (D:\learning\NextJS\forum\.next\server\app\edit\[id]\page.js:1:4469)
        at Function.t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async collectGenerateParams (D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:919:21)
        at async D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1138:17
        at async Span.traceAsyncFn (D:\learning\NextJS\forum\node_modules\next\dist\trace\trace.js:151:20)
    ReferenceError: options is not defined
        at 32623 (D:\learning\NextJS\forum\.next\server\app\page.js:1:5248)
        at t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at 39883 (D:\learning\NextJS\forum\.next\server\app\page.js:1:4005)
        at Function.t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async collectGenerateParams (D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:919:21)
        at async D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1138:17
        at async Span.traceAsyncFn (D:\learning\NextJS\forum\node_modules\next\dist\trace\trace.js:151:20)
    ReferenceError: options is not defined
        at 32623 (D:\learning\NextJS\forum\.next\server\app\detail\[id]\page.js:1:5733)
        at t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at 39883 (D:\learning\NextJS\forum\.next\server\app\detail\[id]\page.js:1:4703)
        at Function.t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async collectGenerateParams (D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:919:21)
        at async D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1138:17
        at async Span.traceAsyncFn (D:\learning\NextJS\forum\node_modules\next\dist\trace\trace.js:151:20)
    ReferenceError: options is not defined
        at 32623 (D:\learning\NextJS\forum\.next\server\app\write\page.js:1:5230)
        at t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at 39883 (D:\learning\NextJS\forum\.next\server\app\write\page.js:1:3780)
        at Function.t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async collectGenerateParams (D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:919:21)
        at async D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1138:17
        at async Span.traceAsyncFn (D:\learning\NextJS\forum\node_modules\next\dist\trace\trace.js:151:20)
    ReferenceError: options is not defined
        at 32623 (D:\learning\NextJS\forum\.next\server\app\list\page.js:1:5991)
        at t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at 39883 (D:\learning\NextJS\forum\.next\server\app\list\page.js:1:4584)
        at Function.t (D:\learning\NextJS\forum\.next\server\webpack-runtime.js:1:128)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async collectGenerateParams (D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:919:21)
        at async D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1138:17
        at async Span.traceAsyncFn (D:\learning\NextJS\forum\node_modules\next\dist\trace\trace.js:151:20)
    > Build error occurred
    Error: Failed to collect page data for /_not-found
        at D:\learning\NextJS\forum\node_modules\next\dist\build\utils.js:1258:15
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      type: 'Error'
    }
       Collecting page data  .
    
    =======
    package.json
    
    {
      "name": "forum",
      "version": "0.1.0",
      "private": true,
      "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint"
      },
      "dependencies": {
        "@auth/mongodb-adapter": "^2.3.3",
        "dotenv": "^16.4.4",
        "mongodb": "^6.3.0",
        "next": "14.1.0",
        "next-auth": "^4.24.5",
        "react": "^18",
        "react-dom": "^18",
        "typescript": "^5.3.3"
      },
      "devDependencies": {
        "@types/node": "20.11.19",
        "@types/react": "18.2.56"
      }
    }
    
    npm run build라 하면 이런 오류가 뜨는데 구글링을 해도 무엇인지 모르겠어서 질문합니다
    Node.js 버전은 20.11.0입니다
    #114262

    codingapple
    키 마스터
    app\edit\[id]\page.js 파일에 options가 정의가 안되어있다는소리같습니다
    #114267

    김환진
    참가자
    import { connectDB } from "@/util/database"
    import { ObjectId } from "mongodb"
    export default async function Edit(props) {
      const db = (await connectDB).db('forum')
      let result = await db.collection('post').findOne({ _id: new ObjectId(props.params.id) })
      return (
        <div className="p-20">
          <h4>수정페이지</h4>
          <form action="/api/post_db/edit" method="POST">
            <input name="title" type='textarea' defaultValue={result.title} />
            <input name="content" type='textarea' defaultValue={result.content} />
            <input name="_id" defaultValue={result._id.toString()} style={{ display: 'none' }} />
            <button type="submit">수정</button>
          </form>
        </div>
      )
    }
    
    app\edit\[id]\page.js파일인데 강의랑 다를게 없어 보입니다
    
    #114306

    codingapple
    키 마스터
    다른 파일들에도 options 변수같은게 있나 확인해봅시다
4 글 보임 - 1 에서 4 까지 (총 4 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠