Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install SWA CLI on Alpine Linux #509

Open
justinyoo opened this issue May 25, 2022 · 7 comments
Open

Unable to install SWA CLI on Alpine Linux #509

justinyoo opened this issue May 25, 2022 · 7 comments
Assignees
Labels
command: deploy All issues related to the deploy command command: login All issues related to the login command scope: cli Issues happened a the ./src/cli level type: bug Something isn't working

Comments

@justinyoo
Copy link

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 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 mcr.microsoft.com/azure-cli:2.33.1
  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 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
  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, 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...

@manekinekko
Copy link
Member

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.

@manekinekko
Copy link
Member

FYI, I opened an issue at atom/node-keytar#461

@manekinekko manekinekko added type: bug Something isn't working scope: cli Issues happened a the ./src/cli level command: deploy All issues related to the deploy command command: login All issues related to the login command labels May 25, 2022
@justinyoo
Copy link
Author

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 keytar@7.9.0 install node_modules/@azure/static-web-apps-cli/node_modules/keytar prebuild-install || npm run build
npm info run keytar@7.9.0 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 npm@8.11.0 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 keytar@7.9.0
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

@Nexyll
Copy link

Nexyll commented 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.

@justinyoo
Copy link
Author

@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).

@tnabil
Copy link

tnabil commented Nov 21, 2022

Hi, any updates on this issue or suggested workarounds?

@reddyeshwar17
Copy link

hello team, I am also similar issue ..how to resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command: deploy All issues related to the deploy command command: login All issues related to the login command scope: cli Issues happened a the ./src/cli level type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants