azure webapp webjob 节点版本 [英] azure webapp webjob node version

查看:22
本文介绍了azure webapp webjob 节点版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何定义用于运行 azure webjobs 的节点版本?

服务器当前使用 v0.11 执行我的代码,但由于我使用需要节点 >8 的功能而失败

网络应用程序本身在节点 8 上运行良好,但网络作业的版本似乎独立于网络服务器本身.

解决方案

在 Azure WebApp 上,对于 Node.js 运行时,有一个比 0.10.40 或其他类似 0.11 如你所说.如果您想更改运行 webjob 的默认 Node 版本,可以通过以下两种方式进行配置.

  1. 在 Azure 门户的 Application settings 选项卡中将 WEBSITE_NODE_DEFAULT_VERSION 的值设置为所需的版本号.您可以参考我对现有 SO 线程

  2. 要创建一个包含 Node JavaScript 和引导文件的 webjob zip 文件,请参阅官方文档

    然后,按照下图步骤,你可以添加 &运行您的 webjob zip 文件并通过 Logs 查看输出结果.

这是我设置 Node 运行时版本 10.14.1 时在 Logs 中的结果.

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.

  1. 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.

  2. 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.

这篇关于azure webapp webjob 节点版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆