Search code examples
reactjsnode.jsnext.jsnextjs14

how to run build next js project and how to solve this kind of error?


hi everyone so i wanted to build my project and this is what terminal shows me

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 ✓ Linting and checking validity of types
 ✓ Collecting page data    
   Generating static pages (4/15)  [=   ]TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async j (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\AllCourses\page.js:1:12070) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '4112102185'
}
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async j (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\AllCourses\page.js:1:12070) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '4112102185'
}
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async j (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\AllCourses\page.js:1:12070) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '4112102185'
}

Error occurred prerendering page "/AllCourses". Read more: https://nextjs.org/docs/messages/prerender-error

TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async j (H:\0.1 ' SECRET POROJECTS\next js\next js 
connected to db
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async o (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\p-user\Enrolledcourses\page.js:1:2686) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '3962816116'
}
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async o (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\p-user\Enrolledcourses\page.js:1:2686) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '3962816116'
}
   Generating static pages (9/15)  [==  ]TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async T (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\page.js:1:12946) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '4196140424'
}
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async T (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\page.js:1:12946) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '4196140424'
}
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async T (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\page.js:1:12946) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '4196140424'
}
connected to db
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async o (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\p-user\page.js:1:3104) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '1424250269'
}
TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async o (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\p-user\page.js:1:3104) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1667:5)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error], [Error] ]
  },
  digest: '1424250269'
}

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error

TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async T (H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\server\app\page.js:1:12946)
 ✓ Generating static pages (15/15)

> Export encountered errors on following paths:
        /AllCourses/page: /AllCourses
        /page: /

and when i run npm run start this is what terminal shows me

[Error: ENOENT: no such file or directory, open 'H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\prerender-manifest.json'] {  
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: "H:\\0.1 ' SECRET POROJECTS\\next js\\next js projs\\nabeghe\\.next\\prerender-manifest.json"
}

im using next 14 and latest node js if you guys have ever solve this kind of error pleas let me know if there is a way that i can fix this problem

i was uninstall and reinstall next and nothing some people say something about .env and replace localhost with prosess.env.LOCALHOST or something i have to know if is it worth trying or not


Solution

  • The issue seems to revolve around failed fetch requests and missing files during the prerendering process. Your project is failing the build and thus your files are not being generated. Result:

    [Error: ENOENT: no such file or directory, open 'H:\0.1 ' SECRET POROJECTS\next js\next js projs\nabeghe\.next\prerender-manifest.json'] {  
      errno: -4058,
      code: 'ENOENT',
      syscall: 'open',
      path: "H:\\0.1 ' SECRET POROJECTS\\next js\\next js projs\\nabeghe\\.next\\prerender-manifest.json"
    }
    

    Try pinging with the correct request (GET,POST...) the endpoint you are calling in the root page '/' (the fetch function I guess) to confirm it is working or if that is the issue. Can't seems to come up with anything else with the information provided