You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure部署Node.js应用遇DEP0064弃用警告致启动失败求助

Fixing the [DEP0064] DeprecationWarning When Deploying Node.js App to Azure

Hey there, let's tackle this [DEP0064] DeprecationWarning that's stopping your Node.js app from starting on Azure. Here's a step-by-step breakdown to resolve it:

What's Causing This?

The warning flags that your app (or one of its dependencies) is using tls.createSecurePair()—an API that's been deprecated since Node.js v10 and removed in newer versions. Modern Node.js environments (like the one Azure uses) no longer support this method, which is why your app fails to launch.

Step 1: Verify Node.js Version on Azure

First, confirm the Node.js version running on your Azure App Service:

  • Go to your App Service in the Azure Portal → Configuration → General settings
  • Check the "Node.js version" dropdown. If it's v14 or higher, this deprecated API will definitely break your app.

Step 2: Locate the Problematic Code/Dependency

Check Your Own Code

Search your codebase for any direct calls to tls.createSecurePair(). If you find it, replace it with tls.Socket as recommended. For example, if you had code like:

const tls = require('tls');
const pair = tls.createSecurePair(/* options */);

Replace it with a tls.Socket implementation tailored to your secure connection needs (refer to Node.js core docs for usage specifics matching your use case).

Check Third-Party Dependencies

If your code doesn't use the deprecated API, the issue is in one of your npm packages. To find which one:

  1. Run this command in your local project directory:
    npm ls | grep createSecurePair
    
    This will list any dependencies that include the deprecated method.
  2. Once you identify the package, check its GitHub repo or npm page for updates. Most maintainers fix deprecation issues in newer versions—upgrade the package to the latest compatible version using:
    npm update [package-name]
    

Step 3: Adjust Azure Deployment Settings

  • Ensure you're not uploading local node_modules to Azure. Instead, enable automatic dependency installation:

    1. In Azure Portal, go to your App Service → Configuration → Application settings
    2. Add a new setting with key SCM_DO_BUILD_DURING_DEPLOYMENT and value true
      This forces Azure to run npm install during deployment, ensuring dependencies are installed for the Node.js version running on Azure.
  • Avoid using NODE_OPTIONS="--no-deprecation" as a quick fix—it only hides the warning, not the underlying issue breaking your app.

Step 4: Dig Into Azure Logs

You mentioned the log path is D:\home\LogFiles\Application>—check the detailed logs here (like application.log) to find the exact file and line number where tls.createSecurePair() is being called. This will speed up pinpointing the problematic code or dependency.

内容的提问来源于stack exchange,提问作者CoderX

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:56:26