尝试连接调试器时 Azure Functions 崩溃,导致 nodemon 永久重新加载
Azure Functions crash when attempting to connect debugger, causes nodemon to perpetually reload
尝试了干净的格式并重新安装 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/
经过多次调试后,我发现问题与我的 package.json:
有关
"scripts": {
"watch": "tsc -w",
"start:host": "func start --cors *",
"start": "npm run start:host & npm run watch",
},
看起来& nom 运行 watch 出于某种原因终止了macOS 中的进程。由于 npm 运行 watch 即使在 windows 上也从未真正起作用(总是必须在文件夹中执行单独的 tsc -w 才能重新编译工作)我决定只删除 eit.
如果有人可以解释原因或提出更好的解决方案,我对此持开放态度,因为这是一个非常俗气的解决方案。
尝试了干净的格式并重新安装 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/
经过多次调试后,我发现问题与我的 package.json:
有关"scripts": {
"watch": "tsc -w",
"start:host": "func start --cors *",
"start": "npm run start:host & npm run watch",
},
看起来& nom 运行 watch 出于某种原因终止了macOS 中的进程。由于 npm 运行 watch 即使在 windows 上也从未真正起作用(总是必须在文件夹中执行单独的 tsc -w 才能重新编译工作)我决定只删除 eit.
如果有人可以解释原因或提出更好的解决方案,我对此持开放态度,因为这是一个非常俗气的解决方案。