node.js - Azure Functions 本地 HTTP 触发器问题及解决方案

标签 node.js azure visual-studio-code azure-functions nvm

只是想发布我在尝试在 VS Code 中本地运行 Azure Function 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.) 安装 NVM。说明在这里:https://github.com/nvm-sh/nvm#installing-and-updating

(2.) 安装 NVS。说明在这里:https://github.com/jasongin/nvs

(3.) 在 VS code 终端中,运行:

nvs add 12.16.1
nvs use node/12.16.1/x64

(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.) 在 VS code 终端中,运行:

func start

关于node.js - Azure Functions 本地 HTTP 触发器问题及解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60895548/

相关文章:

javascript - 转到 Typescript Source Definition 而不是 Visual Studio Code 中的 Compiled Definition

node.js - 运行 `ng serve`后出现 `ng update @angular/cli @angular/core`错误,无法为Angular项目提供服务

javascript - Javascript 中 consice 方法中的词法 this

node.js - Node/Express 服务器端包含静态文件的等效项

javascript - 异步等待和可共享的 MongoDB 连接

azure - 如何访问 azure 存储$logs

node.js - 将 Blob 上传到 Azure 存储不适用于使用 NodeJs 的本地开发模拟器

java - 在没有调试器的情况下在 VS Code 中导航 Java 堆栈跟踪

azure - 使用 GraphQL 连接到 CosmosDB?

visual-studio-code - 如何将 Windows 上的 VSCode 键映射转移到 ubuntu