3
votes

Have tried clean formats and re-installing nodemon to no avail, when running with azure functions and tsc -w without changing anything I get this on loop (the is a snippet there's much more):

[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

The VSCode config I'm using:

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

and 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...\"" },

This does not happen in bootcamp where it behaves as expected, I have disabled cloud synching for documents where these files are.

Update

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

2

2 Answers

3
votes

nodemon requires you to specify which files you want to watch, elseway it will check anything in the cwd. You can use the --watch flag, i.e. --watch dist/

2
votes

After much more debugging I found the issue had to do with my package.json:

"scripts": {
    "watch": "tsc -w",
    "start:host": "func start --cors *",
    "start": "npm run start:host & npm run watch",
  },

Looks like & nom run watch was killing the process in macOS for whatever reason. Since npm run watch never really worked even on windows (always had to do a seperate tsc -w in the folder to get recompiling working) I decided to just remove eit.

If someone can explain why or propose a better fix I'm very open to that as this is a very tacky solution.