How to fix next.js error: Error: > Build failed because of webpack errors

6.6k Views Asked by At

I'm trying to deploy a next.js app to netlify and trying to get the output folder but when I run "npm run build" I get an error like: Error: > Build failed because of webpack errors at build (C:\Users\Owner\Desktop\port_frontend\node_modules\next\dist\build\index.js:15:918)

3

There are 3 best solutions below

0
On

Try to install package again, you hvn't update the latest;

npm install
npm run build

OR

yarn install
yarn build
0
On

change import next/App to lowercase ,it works for me

0
On

For my case, delete node_modules folder, and run yarn install works for me