Code-server: ENOENT when using --open on Linux

Created on 28 May 2019  路  5Comments  路  Source: cdr/code-server

  • code-server version: v1.1119-vsc1.33.1
  • OS Version: Ubuntu 18.10 on local computer

Description

When using --open switch, code-server starts correctly but fails to actually open the browser:

$ code-server --host 127.0.0.1 --allow-http --no-auth --disable-telemetry --open dev/0x40.ale.sh/
(node:18645) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server v1.1119-vsc1.33.1
...
WARN  Url couldn't be opened automatically. {"url":"http://localhost:8443/","exception":{"errno":"ENOENT","code":"ENOENT","syscall":"spawn /src/packages/server/out/xdg-open","path":"/src/packages/server/out/xdg-open","spawnargs":["http://localhost:8443/"]}}
...

Perhaps you wanted to use a system xdg-open instead? :)

(PS Thanks for this awesome tool, and for [sail], too!)

bug

Most helpful comment

open includes it's own version of xdg-open and prefers to use that whenever possible, but this doesn't work in binaries produced by nbin.

I created a PR on open to add an option for always using the system version instead of the bundled version of xdg-open: https://github.com/sindresorhus/open/pull/138. Once this is merged, we can enable this option in cli.ts.

All 5 comments

It looks like it wanted to use xdg-open. You could ctrl + click the URL that was printed before this warning.

Note: This is also just a warning, so there is nothing to really worry about.

Edit:

Reproduced while using sail.

Steps:

  • sail run cdr/sail
  • sail shell cdr/sail
  • code-server --host 127.0.0.1 --allow-http --no-auth --disable-telemetry --open dev/0x40.ale.sh/

open includes it's own version of xdg-open and prefers to use that whenever possible, but this doesn't work in binaries produced by nbin.

I created a PR on open to add an option for always using the system version instead of the bundled version of xdg-open: https://github.com/sindresorhus/open/pull/138. Once this is merged, we can enable this option in cli.ts.

It looks like open takes an app argument so that could also be an option.

A fix (https://github.com/sindresorhus/open/pull/140, version 6.4.0) was merged into open that checks if the local xdg-open is executable before using it, which should solve this specific problem. Once we've confirmed it's working we can close this issue.

Fixed in #819.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KSXGitHub picture KSXGitHub  路  3Comments

RealSlimMahdi picture RealSlimMahdi  路  3Comments

balazssoltesz picture balazssoltesz  路  3Comments

justmao945 picture justmao945  路  3Comments

lshamis picture lshamis  路  3Comments