Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to install SWA CLI on Alpine Linux

See original GitHub issue

Describe the bug

I’m using a Docker container image,, which is based on Alpine Linux.

I installed nvm and the latest node v16.x successfully. But I wasn’t able to install this SWA CLI. It threw an error:

~ # npm install -g @azure/static-web-apps-cli
npm notice
npm notice New minor version of npm available! 8.5.5 -> 8.10.0
npm notice Changelog:
npm notice Run npm install -g npm@8.10.0 to update!
npm notice
npm ERR! code ENOENT
npm ERR! syscall spawn sh
npm ERR! path /root/.nvm/versions/node/v16.15.0/lib/node_modules/@azure/static-web-apps-cli/node_modules/keytar
npm ERR! errno -2
npm ERR! enoent spawn sh ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

To Reproduce Steps to reproduce the behavior:

  1. Open a container image like docker run -it
  2. Run the following commands:
# Update and upgrade
apk update && apk upgrade \
    && apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers grep util-linux binutils findutils \
    && apk add -U bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib \
    && apk add -U libgdiplus --repository \
    && apk add -U libc6-compat gcompat

# Install nvm
cd ~
curl -o- | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm

# Install node.js
nvm install --lts
nvm use --lts

# Install SWA CLI
npm install -g @azure/static-web-apps-cli
  1. See the error above

Expected behavior A clear and concise description of what you expected to happen.

The SWA CLI should be installed successfully.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: A container image,, based on Alpine Linux

Additional context Add any other context about the problem here.

If I ran the yarn command like:

corepack enable
yarn global add @azure/static-web-apps-cli

It was fine, but I still have the same issue after that, by running npm install or npm run build, etc…

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

Nexyllcommented, Jun 21, 2022

@justinyoo To fix the npm install of the asw CLI, I had to add the following packages: apk add --no-cache python3 py3-pip libsecret-dev alpine-sdk, then the npm install passed.

tnabilcommented, Nov 21, 2022

Hi, any updates on this issue or suggested workarounds?

Read more comments on GitHub >

github_iconTop Results From Across the Web

1. Install the SWA CLI | Static Web Apps CLI
You can install the Static Web Apps CLI using npm, yarn or pnpm.
Read more >
2021-06-01 17:13:34 <y34h> I wasn't able to install neither to rpi1 nor to rpi4 2021-06-01 17:13:49 <y34h> but the erros regarded different packages ......
Read more >
azure-swa Archives - Timur and associates
start a blank workspace folder, hit F1; type “Add Development Container” and select the menu item. type something and click “Show All Definitions”....
Read more >
Error while creating docker image of azure-cli with Alpine linux ...
You could use the base docker image for the azure-cli and add to it. It is built on alpine.
Read more >
Linux Add a Swap File Tutorial - nixCraft
Explains how to add a swap file under any Linux distribution using command line utilities and update /etc/fstab file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found