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/

相关文章:

javascript - Node JS POST 请求返回未定义的正文

javascript - AngularJS 与 NodeJS GET 请求失败 - "Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers"

vue.js - Apollo - update() 方法被调用两次,两次都使用乐观/假数据

javascript - GraphQL:获取数据库列到不同的ObjectType字段属性

javascript - npm 发布卡住(使用 yarn )

angular - 为 Angular 应用程序设计

javascript - require.js 需要一个带有 index.js 的模块

typescript - 如何在 TypeScript 中正确更改变量的类型?

graphql - 当所有请求都具有相同的 URL 时,如何在开发工具网络选项卡中区分 GraphQL 请求?

node.js - 在 EJS 上打印原始 html 字符串