static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

Environment variable DISPLAY is not set

Open adriancuadrado opened this issue 3 years ago • 4 comments

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • [ ] No, I am using a different port number (--port) and accessing the CLI from that port
  • [x] Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug I get this error when running swa login:

$ swa login --verbose=silly

Welcome to Azure Static Web Apps CLI (1.0.1)

Getting config file options from swa-cli.config.json...
Changed directory to /home/adrian/temp/swa
Using configuration "swa" from file:
  /home/adrian/temp/swa/swa-cli.config.json

Checking Azure session...
Executing authenticateWithAzureIdentity
- details:
  - tenantId: <undefined>
  - clientId: <undefined>
  - clientSecret: <undefined>
 - useKeychain: true
Keychain is enabled
Executing swaCliPersistencePlugin
Executing before cache access plugin
Machine ID: <hidden>
Invoking crypto service
Getting credentials
Getting credentials from native keychain
Getting keychain reference
isKeychainEnabled: true
KeychainCache: undefined
Attempting to load native keychain
✖ Environment variable DISPLAY is not set.
✖ An X11 server is required when keychain is enabled. You can disable keychain using --no-use-keychain or try a different login method.

To Reproduce Steps to reproduce the behavior:

  1. Run swa login from WSL

Expected behavior It should login

Screenshots N/A

Desktop (please complete the following information):

  • OS: Windows
  • Version 10

Additional context N/A

adriancuadrado avatar May 22 '22 12:05 adriancuadrado

Hey @adriancuadrado, can you install an X11 server (such as VcXsrv) and set the DISPLAY variable, by adding (for instance) this line in your .bashrc file:

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

manekinekko avatar May 23 '22 07:05 manekinekko

@manekinekko I have installed VcXsrv, but I have zero experience with X11 servers. Would you mind to tell me what I have to do step by step? So far I installed it and executed the xlaunch.exe file. Then I selected the "Multiple windows" option (No idea which of the 4 options I have to select) and left the display number to -1. Then in the next screen I selected "Start no client" and in the last screen I left the checboxes to their default valures: Clipboard, Primary Selection and Native opengl.

adriancuadrado avatar May 27 '22 19:05 adriancuadrado

Also I don't understand why I have to do any of this when commands like az login just work without this kind of set up. az login doesn't require any X11 server or any export DISPLAY=... anywhere, so I expected the swa command to not require anything like that likewise.

adriancuadrado avatar May 27 '22 19:05 adriancuadrado

I am in the same environment, but I had to add the following options to run swa login from WSL.

swa login --no-use-keychain

k-miyake avatar Aug 04 '22 00:08 k-miyake