I modified the swa cli js files to include extra logging and found the root cause was because I did not have an index.html file, I only had a home.html file.
How to resolve Node Error when deploying azure static web app with the statice web app CLI
I am executing the Static Web App CLI to deploy a simple HTML website.
swa deploy --api-language none --api-version none --env Production --verbose > deployment-log.txt 2>&1
The error I get is below. How do I fix this?
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
The swa-cli-config.json is
{
"$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 version is 20.18.3, but I have also tried it with versions 18.17.1, 16.20.2 and 15.14.0.
SWA CLI version is 2.0.3
2 answers
Sort by: Most helpful
-
-
Laxman Reddy Revuri 2,540 Reputation points Microsoft Vendor
2025-02-18T12:21:12.56+00:00 Hi @Dean
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer.Ask : How to resolve Node Error when deploying azure static web app with the statice web app CLI
I modified theswa cli js
files to include extra logging and found the root cause was because I did not have an index.html file, I only had a home.html file.Please don’t forget to
Accept Answer
andYes
for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.