Azure / Azure/azure-cli

Unable to deploy Frontend React App v20+ on Azure Static Web App

Open
#29,456 5 comments 0 reactions 0 assignees View on GitHub
bug customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

I have a pipeline in bitbucket in which I am building a react v20 app to be deployed on Azure Static Web App. Although the code compiles successfully but when we install Azure CLI usinf NPM i command and than try to deploy the compiled artifacts to the SWA using the deployment token we face an error.

### Related command

development:
- step:
deployment: devBuild
name: 'Build'
caches:
- my-node-cache
script:
- npm i --legacy-peer-deps
- export NODE_OPTIONS="--max-old-space-size=8192"
- npm run build
- npm i -g @azure/static-web-apps-cli
- swa deploy --deployment-token=$dev_deployment_token --env=production

### Errors

swa deploy --deployment-token=$dev_deployment_token --env=production

<1s
+ swa deploy --deployment-token=$dev_deployment_token --env=production
file:///usr/local/lib/node_modules/@azure/static-web-apps-cli/dist/cli/index.js:22
import pkg from "../../package.json" with { type: "json" };
^^^^
SyntaxError: Unexpected token 'with'
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:117:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:361:14)

Node.js v20.2.0

### Issue script & Debug output

N/A

### Expected behavior

N?A

### Environment Summary

N/A

### Additional context

Please help me in resolving this issue as my new build is dependent on it

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.