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

使用Static Web Apps CLI部署Azure静态Web应用时的Node错误解决

使用SWA CLI部署静态HTML网站时出现NativeCommandError

我尝试用Azure Static Web Apps CLI部署一个简单的HTML网站,执行的部署命令如下:

swa deploy --api-language none --api-version none --env Production  --verbose > deployment-log.txt 2>&1

部署日志输出如下:

Welcome to Azure Static Web Apps CLI (2.0.3)

Using configuration "static-web-apps-play-ground" from file:
  C:\Users\####\source\repos\StaticWebApps-PlayGround\swa-cli.config.json

Deploying front-end files from folder:
  C:\Users\####\source\repos\StaticWebApps-PlayGround\src


Deploying to environment: Production

Deploying project to Azure Static Web Apps...
node.exe : - Preparing deployment. Please wait...
At C:\nvm4w\nodejs\swa.ps1:16 char:5
+     & "$basedir/node$exe"  "$basedir/node_modules/@azure/static-web-a ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (- Preparing deployment. Please wait...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

使用的swa-cli.config.json配置内容:

{
  "$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
  "configurations": {
    "static-web-apps-play-ground": {
      "appLocation": "./src/",
      "appName": "swa-playground",
      "resourceGroup": "rg-swa-playground"
    }
  }
}

已尝试过的环境版本:

  • Node.js版本:20.18.3、18.17.1、16.20.2
  • SWA CLI版本:2.0.3

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.14 10:08:21