天蓝色webapp webjob节点版本 [英] azure webapp webjob node version
问题描述
如何定义用于运行Azure Webjobs的节点版本?
How can I define the node version that is used to run azure webjobs?
该服务器当前使用v0.11执行我的代码,但由于我使用要求节点> 8的功能而失败
The server currently executes my code with v0.11 and fails since I use features that require node >8
Web应用程序本身可以在节点8上正常运行,但是webjobs的版本似乎独立于Web服务器本身.
The web app itself runs on node 8 just fine, but the version for webjobs seems to be independent of the webserver itself.
推荐答案
在Azure WebApp上,对于Node.js运行时,有一个默认版本,该版本早于0.10.40
或其他类似0.11
的版本,如您所说.如果要更改默认的Node版本以运行Webjob,可以通过以下两种方法对其进行配置.
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.
-
要在Azure门户的
Application settings
选项卡中使用所需的版本号设置WEBSITE_NODE_DEFAULT_VERSION
的值.您可以参考我对现有SO线程 Azure NodeJS版本的答案.
To set the value of
WEBSITE_NODE_DEFAULT_VERSION
with the version number you want inApplication settings
tab of Azure portal. You can refer to my answer for the existing SO thread Azure NodeJS version.
要创建一个打包为Node JavaScript和引导文件的zip文件作为webjob,请参阅官方文档
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
然后,按照下图步骤,您可以添加&运行您的webjob压缩文件,并通过Logs
查看输出结果.
Then, following the below figure steps, you can add & run your webjob zip file and see the output result via Logs
.
当我按如下所示设置节点运行时版本10.14.1
时,这是Logs
中的结果.
Here is my result in Logs
when I set my Node runtime version 10.14.1
as below.
这篇关于天蓝色webapp webjob节点版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!