How can I define the node version that is used to run azure webjobs?
The server currently executes my code with v0.11 and fails since I use features that require node >8
The web app itself runs on node 8 just fine, but the version for webjobs seems to be independent of the webserver itself.
On Azure WebApp, for Node.js runtime, there is a default version which be older that 0.10.40 or others like 0.11 as you said. If you want to change the default Node version for running your webjob, there are two ways below to configure it.
To set the value of
WEBSITE_NODE_DEFAULT_VERSIONwith the version number you want inApplication settingstab of Azure portal. You can refer to my answer for the existing SO thread Azure NodeJS version.To create a zip file as webjob which wrapped your Node JavaScript and a bootstrap file, please refer to the offical document
Supported file types for scripts or programs. For example, a WebJob zip file includesindex.jsandrun.batas below, you can set thePATHenvironment to add the Node runtime path supported by Azure (you can list all version of NodeJS on Azure by following my answer above) to make it works.index.js
console.log(process.version)run.bat
set PATH=D:/Program Files (x86)/nodejs/8.11.1/;%PATH% node index.jsThen, following the below figure steps, you can add & run your webjob zip file and see the output result via
Logs.
Here is my result in Logs when I set my Node runtime version 10.14.1 as below.
来源:https://stackoverflow.com/questions/54771467/azure-webapp-webjob-node-version



