Unable to install SWA CLI on Alpine Linux
See original GitHub issueDescribe the bug
I’m using a Docker container image, mcr.microsoft.com/azure-cli:2.33.1
, 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: https://github.com/npm/cli/releases/tag/v8.10.0
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:
- Open a container image like
docker run -it mcr.microsoft.com/azure-cli:2.33.1
- 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 https://dl-3.alpinelinux.org/alpine/edge/testing/ \
&& apk add -U libc6-compat gcompat
# Install nvm
cd ~
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Install node.js
nvm install --lts
nvm use --lts
# Install SWA CLI
npm install -g @azure/static-web-apps-cli
- 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, mcr.microsoft.com/azure-cli:2.33.1, 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:
- Created a year ago
- Comments:6 (2 by maintainers)
Top 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 >alpine-linux-2021-06.log
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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.Hi, any updates on this issue or suggested workarounds?