I am trying to debug an Azure Function App in VS Code. The Function App was created in VS Code like described in the Azure Documentation. During this process a .vscode directory was created with the following configuration:
.vscode/launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach to Node Functions",
      "type": "node",
      "nodeVersionHint": 18,
      "request": "attach",
      "port": 9229,
      "preLaunchTask": "func: host start"
    }
  ]
}
.vscode/settings.json
{
"azureFunctions.deploySubpath": ".",
"azureFunctions.postDeployTask": "npm install (functions)",
"azureFunctions.projectLanguage": "TypeScript",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "npm prune (functions)"
}
When I start the debugger with this configuration I get this error message:
Azure Functions Core Tools
Core Tools Version:       4.0.5085 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.16.4.20366
[2023-08-16T19:33:11.815Z] [error] Incompatible Node.js version (v20.3.1). Refer to our documentation to see the Node.js versions supported by each version of Azure Functions: https://aka.ms/functions-node-versions
During researching this problem I found a lot of Stackoverflow threads from 2017 and 2018 like:
- Visual Studio Code to use node version specified by NVM
- VS Code, change NodeJS version for debugger
- Why VSCode keeps using old node.js version on nvm?
- Why is node version not changing in VS Code?
If I understand it correctly since then, it is supported that VS Code uses the Node.js version managed by NVM.
My default NVM version is 18.17.
nvm list
->     v18.17.1
         system
default -> 18 (-> v18.17.1)
I also made sure that VS Code is using the same shell as I do. Now what really throws me off is that I completely deleted Node.js version 20 via NVM.
So my question now is: Is there any other place where Node.js versions are configured in VS Code, specifically for the debugger?
 
    




