prismic-cli icon indicating copy to clipboard operation
prismic-cli copied to clipboard

Prismic CLI does not work under WSL2

Open lure23 opened this issue 1 year ago • 0 comments

Just a reminder that the Prismic login feature doesn't work under WSL2.

Preparation

$ sudo npm install -g prismic-cli
...

Any browser would likely do:

$ sudo apt install firefox
...

Steps

$ prismic login
Prismic: Press any key to open up the browser to login or q to exit:
Opening browser to https://prismic.io/dashboard/cli/login?port=5555
Prismic: Logging in... done
node:internal/child_process:421
    throw new ErrnoException(err, 'spawn');
          ^

Error: spawn EIO
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:761:9)
    at Object.open (/usr/lib/node_modules/prismic-cli/node_modules/cli-ux/lib/open.js:64:29)
    at /usr/lib/node_modules/prismic-cli/lib/utils/server.js:77:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -5,
  code: 'EIO',
  syscall: 'spawn'
}

Node.js v20.12.2

The error message doesn't really reveal much. Spawning fails, but why?

Expected

Since I am running Linux, and there is a browser, I can log in to my Prismic account, in order to do development.

Actual

The command fails.

Note: If you try the same with sudo, the error message is different - but weirder.

 syscall: 'spawn cmd.exe',
 path: 'cmd.exe',
 spawnargs: [
   '/c',
   'start',
   '""',
   '/b',
   'https://prismic.io/dashboard/cli/login?port=5555'
 ]

I would really like to give Prismic a go, but since it's not compatible with either WSL or a headless Linux sandbox, I might need to pass.

Versions

$ uname -a
Linux [...]5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux`
$ node --version
v20.12.2
$ npm --version
10.5.2

lure23 avatar Apr 18 '24 09:04 lure23