node.js - 尝试连接调试器时 Azure Functions 崩溃,导致 nodemon 永久重新加载

标签 node.js typescript graphql azure-functions nodemon

尝试过干净的格式并重新安装nodemon但无济于事,当使用azure函数和tsc -w运行而不更改任何内容时,我在循环中得到了这个(这是一个片段,还有更多):

[nodemon] files triggering change check: dist/api/index.js.map [nodemon] matched rule: **/. [nodemon] changes after filters (before/after): 1/0 [nodemon] files triggering change check: dist/api/index.js [nodemon] matched rule: **/. [nodemon] changes after filters (before/after): 1/1 [nodemon] restarting due to changes... [nodemon] dist/api/index.js

[nodemon] files triggering change check: dist/graphql/es.js.map [nodemon] matched rule: **/. [nodemon] changes after filters (before/after): 1/0 [nodemon] files triggering change check: dist/graphql/es.js [nodemon] matched rule: **/. [nodemon] changes after filters (before/after): 1/1 [nodemon] restarting due to changes... [nodemon] dist/graphql/es.js

[nodemon] files triggering change check: dist/graphql/databaseInit.js.map [nodemon] matched rule: **/. [nodemon] changes after filters (before/after): 1/0 [nodemon] files triggering change check: dist/graphql/databaseInit.js [nodemon] matched rule: **/. [nodemon] changes after filters (before/after): 1/1 [nodemon] restarting due to changes... [nodemon] dist/graphql/databaseInit.js

我正在使用的 VSCode 配置:

{ "name": "Launch Backend", "type": "node", "request": "launch", "cwd": "${workspaceRoot}", "runtimeExecutable": "nodemon", "runtimeArgs": [ "--inspect=5858", "--verbose" ], "restart": true, "port": 5858, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" },

和package.json:

"scripts": { "build": "tsc", "watch": "tsc -w", "prestart": "npm run build && func extensions install", "start:host": "func start --cors *", "start": "npm run start:host & npm run watch", "build:production": "npm run prestart && npm prune --production", "test": "echo \"No tests yet...\"" },

这不会在训练营中发生,它的行为符合预期,我已禁用这些文件所在文档的云同步。

更新

Geting this when I just run the base command bypassing nodemon:

29/04/2020 14:56:36] Host initialized (45ms) [29/04/2020 14:56:36] Host started (46ms) [29/04/2020 14:56:36] Job host started [29/04/2020 14:56:36] Starting inspector on 127.0.0.1:5859 failed: address already in use [29/04/2020 14:56:36] Starting worker process:node --inspect=5859 "/Users/ahmed/.nvm/versions/node/v12.16.2/lib/node_modules/azure-functions-core-tools/bin/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 53018 --workerId b6aaf934-a647-46b0-8bde-35ef8584b03a --requestId ef307ac9-edc9-440b-8735-e81f1879029f --grpcMaxMessageLength 134217728 [29/04/2020 14:56:36] node process with Id=11410 started [29/04/2020 14:56:36] Starting inspector on 127.0.0.1:5859 failed: address already in use [29/04/2020 14:56:36] Starting worker process:node --inspect=5859 "/Users/ahmed/.nvm/versions/node/v12.16.2/lib/node_modules/azure-functions-core-tools/bin/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 53018 --workerId c12804a8-bb18-485c-95e0-c516c6fc4599 --requestId c93e0c56-cdf0-4360-869b-d6410005227f --grpcMaxMessageLength 134217728 [29/04/2020 14:56:36] node process with Id=11411 started [29/04/2020 14:56:36] Starting inspector on 127.0.0.1:5859 failed: address already in use [29/04/2020 14:56:36] Exceeded language worker restart retry count for runtime:node. Shutting down Functions Host [29/04/2020 14:56:36] Stopping host... [29/04/2020 14:56:36] Stopping JobHost [29/04/2020 14:56:36] Job host stopped [29/04/2020 14:56:36] Host shutdown completed. [29/04/2020 14:56:36] Host restarted. [29/04/2020 14:56:36] Stopping JobHost [29/04/2020 14:56:36] Job host stopped

最佳答案

nodemon 要求您指定要监视的文件,否则它将检查 cwd 中的任何内容。您可以使用 --watch 标志,即 --watch dist/

关于node.js - 尝试连接调试器时 Azure Functions 崩溃,导致 nodemon 永久重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61435648/

相关文章:

angular - 如何在 typescript 中定义观察者的类型

reactjs - 如何修复 `Warning: Text content did not match. Server: "一些数据“客户端: "Loading..."`

graphql - nestjs context.swithToHttp()。getRequest()返回未定义

javascript - 4.0 中缺少 Gulp 事件

node.js - 如何在 NodeJS 中使用 GraphQL 和 Apollo 上传服务器上传文件?

node.js - 尝试使用 Typescript 生成 Express 的生产版本

javascript - 在 typescript 中声明 for in 循环的键类型

javascript - 在 TypeScript 中输入向后引用

linux - 如何构造我的 URL 以将 GraphQL 请求发送到从 Windows 机器在 Linux 机器上的容器内运行的应用程序?

javascript - 在 node.js 中使用 UDP 和 dgram 获取远程 ip 地址