#Is there a REPL for next.js?
1 messages · Page 1 of 1 (latest)
Hi @uncut gull. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Hmm, I don't know enough to give you a confident answer yet. However, you can debug your Next.js code using either the VS Code debugger (https://code.visualstudio.com/docs/editor/debugging) or Chrome DevTools (https://developers.google.com/web/tools/chrome-devtools) as mentioned in the Next.js documentation (https://nextjs.org/docs/pages/building-your-application/configuring/debugging).
For server-side code, you can pass the --inspect flag to the underlying Node.js process. Here's how you can do it:
NODE_OPTIONS='--inspect' next dev
You should update the dev script on your package.json like this:
{
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev"
}
}
After starting the server, open a new tab in Chrome and visit chrome://inspect. You should see your Next.js application inside the Remote Target section. Click inspect under your application to open a separate DevTools window, then go to the Sources tab.