ihor.eth
ihor.eth

Reputation: 2420

How to fix Azure functions: Incompatible Node.js version (v16.4.1)

I've read thru the doc and created a new azure function with the VS Code extension just using the boilerplate code it spits out.

Then I set this up locally in local.settings.json (I'm on Windows)

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "FUNCTIONS_EXTENSION_VERSION": "~4",
    "WEBSITE_NODE_DEFAULT_VERSION": "~16"
  }
}

But I still get that node version is an incompatible error.

Upvotes: 5

Views: 10309

Answers (2)

Sandip Jadhav
Sandip Jadhav

Reputation: 173

I faced this issue with Node V16.17.0 and azure function core tools V4*

I used command to trace logs

func host start --verbose

Then I saw in logs that it's trying to download Microsoft.Azure.Functions.ExtensionBundle.zip (with some version) to specific folder. In my case it was Microsoft.Azure.Functions.ExtensionBundle.2.13.0.zip

I manually downloaded that file and extracted zip to downloads folder.

Then I sas in logs that before downloading this zip file, It is checking if this file already exists in temp folder and in users folder as well. In my case it was C:\Users\<UserID>\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle

and C:\Users\UserID>\AppData\Local\Temp\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.18.0

Make sure to create folder structure as well if not present.

I just copied contents from extracted folder to this mentioned location.

It worked.

Upvotes: 3

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4776

Make sure your Function core tools version and Function Run time version should be 4.*.

enter image description here

If the version are not 4.*. install the Function Core Tools latest version check here & install required version of node js if you are using windows the version should be (16.9.1) for Linux you can use (16.13.0)

Azure Functions support for Node.js 16.x is now in public preview in Azure Functions runtime 4.0. Node.js 16.13.0, the current LTS version, is available on Linux function apps. Windows function apps currently support version 16.9.1 and will be updated to an LTS version in December 2021. Refer here

Check your settings.json file targeting projectRuntime has ~4 and projectLanguage has javascript

{
"azureFunctions.deploySubpath": ".",
"azureFunctions.postDeployTask": "npm install (functions)",
"azureFunctions.projectLanguage": "JavaScript",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "npm prune (functions)"
}

enter image description here

Upvotes: 7

Related Questions