简体   繁体   English

如何在 WebStorm 中调试 Node.js Azure Functions(在 Mac 上)

[英]How to debug Node.js Azure Functions in WebStorm (on a Mac)

My setup is我的设置是

  • TypeScript 3.5打字稿 3.5
  • Azure Functions Core Tools 2.7.1480 Azure Functions 核心工具 2.7.1480
  • WebStorm 2019.2网络风暴 2019.2
  • MacOs 10.14.6 macOS 10.14.6

To run the functions locally I have the start script in my package.json defined as follows:为了在本地运行这些函数,我在package.json定义了如下启动脚本:

"start": "npm run build:dev && cd dev/dist && env $(cat ../../.env | grep -v ^# | xargs) func start",
"build:dev": "rimraf dev/dist && webpack --mode development --config ./tools/build/webpack.js && cp-cli src/local.settings.json dev/dist/local.settings.json && cd dev/dist && func extensions install --package Microsoft.Azure.WebJobs.ServiceBus --version 3.0.0-beta8",

This means I build my sources and then basically call func start in the build directory.这意味着我构建了我的源代码,然后基本上在构建目录中调用func start

How can I attach the WebStorm debugger to step through my code?如何附加 WebStorm 调试器以单步调试我的代码?

What I did not realize is that you are only able to set env vars via the local.settings.json (which btw you should not check in with your repo).我没有意识到的是,您只能通过local.settings.json设置环境变量(顺便说一句,您不应该使用您的 repo 进行检查)。 You can not use system env variables like with a regular node project.您不能像常规节点项目一样使用系统环境变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM