Nextjs build errors, verbose logging shows nothing

Viewed 3204

I'm using the latest version Nextjs. The project is running fine when testing and running in developer mode. When I try a production build npx next build --debug I get the error below. The output doesn't tell me much about what the problem is. Any ideas how to get the verbose information from this error?

HookWebpackError: Expected an opening square bracket.

Build error occurred Error: > Build failed because of webpack errors at /Users/xxx/projects/nextjs/my-next-website/node_modules/next/dist/build/index.js:17:924 at async Span.traceAsyncFn (/Users/xxx/projects/nextjs/my-next-website/node_modules/next/dist/telemetry/trace/trace.js:6:584)

1 Answers

npx might load a different version of next than your local dependency. I wouldn't recommend running this with npx. Instead make an npm script, or use npm bin next, or if you use yarn you can use local binaries with yarn next.

Related