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:
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?
According to this SO thread answer by Delliganesh Sevanesan and this MS Q & A answer by navba-MSFT
Make sure you have installed a latest version of Azure Functions core tools for your OS. and Latest node.js version, I am using node version 18 like below:-
I created one typescript function and tried checking the node and function core tools version like below:-
node --version
Node installation path:-
/c/Program Files/nodejs/node
func --version
Nodejs installed like below:-