0

thank you for taking time to try to help me out with this problem. I have been trying for over one month to solve this problem but with no luck.

I have followed this Sonny Sangha portfolio tutorial, but in the last 7 minutes and when trying to deploy it to Vercel I had no luck doing that for over one month, I have search a lot and try different solution but each time I get different errors, but after changing the .env.local to .env and fix some Bugs I have being getting the same error over and over.

info  - Linting and checking validity of types...
info  - Creating an optimized production build...
info  - Compiled successfully
info  - Collecting page data...
info  - Generating static pages (0/3)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-e 
e 
error
FetchError: request to http://localhost:3000/api/getPageInfo failed, reason: 
connect 
ECONNREFUSED 127.0.0.1:3000
 at ClientRequest.<anonymous> 
(/vercel/path0/node_modules/next/dist/compiled/node- 
fetch/index.js:1:65756)
at ClientRequest.emit (node:events:527:28)
at Socket.socketErrorListener (node:_http_client:454:9)
at Socket.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
info  - Generating static pages (3/3)
> Build error occurred
Error: Export encountered errors on following paths:
/
at /vercel/path0/node_modules/next/dist/export/index.js:394:19
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Span.traceAsyncFn 
(/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
at async /vercel/path0/node_modules/next/dist/build/index.js:1168:21
at async Span.traceAsyncFn 
(/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
at async /vercel/path0/node_modules/next/dist/build/index.js:1044:17
at async Span.traceAsyncFn 
(/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
at async Object.build [as default] 
(/vercel/path0/node_modules/next/dist/build/index.js:65:29)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this 
command.
Error: Command "yarn run build" exited with 1

this is the repo that contain the source code of my build abdellah-slimani-portfolio-2.0

  • You should not call an internal API route inside `getStaticProps`. Instead, use your API logic directly in `getStaticProps`. See [Fetch error when building Next.js static website in production](https://stackoverflow.com/questions/66202840/fetch-error-when-building-next-js-static-website-in-production). – juliomalves Oct 22 '22 at 14:36

0 Answers0