简体   繁体   English

Azure Functions 本地 HTTP 触发器问题及解决方案

[英]Azure Functions local HTTP trigger issue and solution

Just wanted to post the steps I took after running into the following error when trying to run an Azure Function HTTP Trigger locally in VS Code:只是想发布我在 VS Code 中尝试在本地运行 Azure 函数 HTTP 触发器时遇到以下错误后采取的步骤:

"[error] Incompatible Node.js version. The version you are using is v13.1.0, 
 but the runtime requires an LTS-covered major version. LTS-covered versions 
 have an even major version number (8.x, 10.x, etc.) as per 
 https://github.com/nodejs/Release#release-plan. For deployed code, change 
 WEBSITENODEDEFAULT_VERSION to '~10' in App Settings. Locally, install or 
 switch to a supported node version (make sure to quit and restart your code 
 editor to pick up the changes)."

(1.) install NVM. (1.) 安装 NVM。 Instructions here: https://github.com/nvm-sh/nvm#installing-and-updating这里的说明: https : //github.com/nvm-sh/nvm#installing-and-updating

(2.) install NVS. (2.) 安装 NVS。 Instructions here: https://github.com/jasongin/nvs这里的说明: https : //github.com/jasongin/nvs

(3.) in your VS code terminal, run: (3.) 在你的 VS 代码终端中,运行:

nvs add 12.16.1
nvs use node/12.16.1/x64

(4.) edit your launch.json to the following: (4.) 将您的 launch.json 编辑为以下内容:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Node Functions",
            "type": "node",
            "request": "attach",
            "port": 5555,
            "preLaunchTask": "func: host start"
        }
    ],
    "node": {
        "runtimeVersion": "12.16.1"
    }
}

(5.) in your VS code terminal, run: (5.) 在你的 VS 代码终端中,运行:

func start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM