static-web-apps-cli
static-web-apps-cli copied to clipboard
Unable to install SWA CLI on Alpine Linux
Describe 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 [email protected] 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...
Hey @justinyoo can you share the logs from npm install -g @azure/static-web-apps-cli --verbose
please? It looks like an issue with Keytar, but I am not sure.
FYI, I opened an issue at https://github.com/atom/node-keytar/issues/461
Hey @justinyoo can you share the logs from
npm install -g @azure/static-web-apps-cli --verbose
please? It looks like an issue with Keytar, but I am not sure.
Sure. I also suspect the keytar side... Here's the log:
npm info run [email protected] install node_modules/@azure/static-web-apps-cli/node_modules/keytar prebuild-install || npm run build
npm info run [email protected] install { code: 'ENOENT', signal: undefined }
npm timing reify:rollback:createSparse Completed in 1502ms
npm timing reify:rollback:retireShallow Completed in 0ms
npm timing command:install Completed in 33815ms
npm notice
npm notice New minor version of npm available! 8.5.5 -> 8.11.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.11.0
npm notice Run npm install -g [email protected] to update!
npm notice
npm verb stack Error: spawn sh ENOENT
npm verb stack at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm verb stack at onErrorNT (node:internal/child_process:478:16)
npm verb stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm verb pkgid [email protected]
npm verb cwd /root
npm verb Linux 5.10.102.1-microsoft-standard-WSL2
npm verb argv "/root/.nvm/versions/node/v16.15.0/bin/node" "/root/.nvm/versions/node/v16.15.0/bin/npm" "install" "-g" "@azure/static-web-apps-cli" "--verbose"
npm verb node v16.15.0
npm verb npm v8.5.5
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
npm verb exit -2
npm timing npm Completed in 34015ms
npm verb unfinished npm timer reify 1653527205368
npm verb unfinished npm timer reify:build 1653527237627
npm verb unfinished npm timer build 1653527237628
npm verb unfinished npm timer build:deps 1653527237628
npm verb unfinished npm timer build:run:install 1653527237661
npm verb unfinished npm timer build:run:install:node_modules/@azure/static-web-apps-cli/node_modules/keytar 1653527237661
npm verb code -2
@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.
@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.
@Nexyll I installed what I had installed above + what you suggested, but still have the same error.
This time, I use the container image of mcr.microsoft.com/azure-cli:2.37.0
(version updated from 2.33.1 to 2.37.0).
Hi, any updates on this issue or suggested workarounds?