3

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)

Jimi
  • 1,867
  • 7
  • 31
  • 55

1 Answers1

0

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.

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134