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

azureauth postinstall script - scripts/install.js is not working correctly in wsl #13

Open
sivakumarmedidi opened this issue Apr 17, 2024 · 7 comments

Comments

@sivakumarmedidi
Copy link

🔑 Authenticating to package feed...
Encountered error while performing auth Error: AzureAuth is not installed.
at adoPat (.nvm/versions/node/v20.12.2/lib/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38644:19)
at async generateNpmrcPat (.nvm/versions/node/v20.12.2/lib/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38659:17)
at async setNpmrcPat (.nvm/versions/node/v20.12.2/lib/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38783:51)
at async run (.nvm/versions/node/v20.12.2/lib/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38122:9)
at async.nvm/versions/node/v20.12.2/lib/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38145:16
❌ Authentication to package feed failed.

The azureauth executable which is supposed to be downloaded and installed via postinstall script for azureauth package is not installed correctly in wsl. So, seeing this error. Can this be fixed please?

@MatanBobi
Copy link
Member

MatanBobi commented Apr 18, 2024

This might be related to the bug I've fixed here: #15 which was causing the error thrown to be irrelevant.
Can we get some more details regarding the OS you're using? Is that MacOS? Linux? Windows?

@sivakumarmedidi
Copy link
Author

This is happening in Windows Subsystem for Linux.

process.platform is being resolved as linux and the respective flows are commented out in scripts/install.js

  const DOWNLOAD_MAP = {
    win32: {
      x64: `azureauth-${AZUREAUTH_INFO.version}-win10-x64.zip`,
    },
    darwin: {
      x64: `azureauth-${AZUREAUTH_INFO.version}-osx-x64.tar.gz`,
      arm64: `azureauth-${AZUREAUTH_INFO.version}-osx-arm64.tar.gz`,
    },
    // TODO: support linux when the binaries are available
    // linux: {
    //   def: "azureauth.exe",
    //   x64: "azureauth-${AZUREAUTH_INFO.version}-win10-x64.zip",
    // },
  };

@sivakumarmedidi
Copy link
Author

@jcreamer898, it would be great if you could help me with this. Thanks!

@Stuart-Wilcox
Copy link
Contributor

Hey @sivakumarmedidi the issue is that the underlying library doesn't have a release for linux yet. On WSL, you can get away with using the Windows .exe, and I noticed this behaviour too.

Also confusingly there's two places that do basically the same thing of running underlying azureauth, so I'm going to try and consolidate this. Stay tuned for the fix for WSL

@marcopelegrini
Copy link

marcopelegrini commented Jul 17, 2024

This is also happening when using pnpm exec ado-npm-auth instead of npm

It would be great if npm wasn't hard-coded in the npxAzureAuthCommand so I can have only one package manager being used for my project

@thsparks
Copy link

I'm also seeing the "AzureAuth is not installed" error when running on WSL:

🔑 Authenticating to package feed...
Encountered error while performing auth Error: AzureAuth is not installed.
    at adoPat (/home/<user>/.npm/_npx/db64d855fa186e0a/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38678:19)
    at async generateNpmrcPat (/home/<user>/.npm/_npx/db64d855fa186e0a/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38693:17)
    at async setNpmrcPat (/home/<user>/.npm/_npx/db64d855fa186e0a/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38817:51)
    at async run (/home/<user>/.npm/_npx/db64d855fa186e0a/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38130:9)
    at async /home/<user>/.npm/_npx/db64d855fa186e0a/node_modules/ado-npm-auth/dist/ado-npm-auth.cjs:38153:16
❌ Authentication to package feed failed.

@Stuart-Wilcox , you mentioned "On WSL, you can get away with using the Windows .exe". Can you elaborate on how you got that working? I see a check that looks like it would handle this automatically in the line below, but I'm still seeing the error. Not sure if there's a step I need to run beforehand to ensure it's available here. I tried just installing azureauth in Windows but it didn't seem to have an effect.

memo = isWsl() ? ["azureauth.exe"] : npxAzureAuthCommand;

System Settings

Node version - v18.20.4
Npm version - 10.7.0
WSL - 5.15.153.1-microsoft-standard-wsl2

@thsparks
Copy link

Ah, I was able to get the windows.exe workaround working by following the azureauth windows install instructions found here: https://github.com/AzureAD/microsoft-authentication-cli?tab=readme-ov-file#windows. Previously, I had just been using npm to install it in windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants