我已经使用create-next-app安装了一个项目。
我需要使用我的编辑器:vscode来调试服务器端渲染。因此,我访问了vscode-recipes - how to debug next.js app。
我对该配方进行了轻微修改,以便无需全局安装Next
。
这是我的 launch.json
配置文件:
{
"type": "node",
"request": "launch",
"name": "Next: Node",
"runtimeExecutable": "${workspaceFolder}/node_modules/next/dist/bin/next",
"runtimeArgs": ["-inspect"],
"port": 9229,
"console": "integratedTerminal"
}
当我运行时,出现以下错误:
错误:使用环境变量NODE_OPTIONS而不是:NODE_OPTIONS="--inspect"next dev
我试图将runtimeArgs更改为以下命令,应该可以工作:
"runtimeArgs": ["NODE_OPTIONS=--inspect"]
,但是我收到了其他错误:
No such directory exists as the project root: /Users/username/with-redux-thunk-app/NODE_OPTIONS=--inspect
我该如何正确表达"NODE_OPTIONS=--inspect"
以便与VSCode调试器配合使用?