gpt4 book ai didi

在 Visual Studio Code 中调试 Strapi

转载 作者:行者123 更新时间:2023-12-03 17:44:37 26 4
gpt4 key购买 nike

我正在尝试在 VS Code 中调试我的 Strapi 项目(3.0.0 beta 16.6)。
我的launch.json:

{
"type": "node",
"request": "attach",
"name": "Attach to strapi",
"port": 9229
}

我的 package.json:
"scripts": {
"debug": "node --inspect=127.0.0.1:9229 ./node_modules/strapi/bin/strapi.js develop"
}

调试器附加到进程,但我所有的断点都变得未经验证(显示为黑色,而不是红色)。我的配置有什么问题?

最佳答案

这个答案来自以下 strapi/strapi issue :

我想出了下一个解决方案:
在 server.js 文件中有下一个脚本(我的自定义脚本):

const strapi = require('strapi');
strapi({ dir: process.cwd(), autoReload: true }).start();

我正在通过下一个命令使用 nodemon: nodemon --inspect=0.0.0.0:9228 server.js
现在我可以附加到 9228通过调试器。

关于在 Visual Studio Code 中调试 Strapi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58145392/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com