1

I'm trying to deploy a nextJs app but when I run npm run build I see some of the errors listed below:

Build error occurred Error:

Build failed because of webpack errors at /Users/hassan/Upwork/ROCProjectNext.js/ROCNext/node_modules/next/dist/build/index.js:15:918 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5) at async /Users/hassan/Upwork/ROC Project Next.js/ROC- Next/node_modules/next/dist/build/tracer.js:1:525

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! [email protected] build: next build

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the [email protected] build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!
/Users/hassan/.npm/_logs/2021-04-07T06_52_28_325Z-debug.log

any suggestions?

1
  • Maybe problem in your package.json file, check this one.
    – Alamin
    Commented Apr 7, 2021 at 16:40

1 Answer 1

2

Kindly check your nextjs version in package.json file it is upgraded to latest version. Downgrade the version of nextjs it will help you to avoid this error.

1
  • I am getting a similar error. npm run build works but next build returns "Failed to compile. Module not found: Error: Can't resolve './C:/ProgramData/nvm/v16.4.2/node_modules/next/dist/client/next.js' in 'D:\App\nextjs-blog' > Build failed because of webpack errors" I ensured net is the same version globally (in programeData) and locally for my project (in D:/App)
    – Andy
    Commented May 23, 2022 at 21:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.