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
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_VERSION
with the version number you want in Application settings
tab 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 includes index.js
and run.bat
as below, you can set the PATH
environment 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.js
Then, 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.