sindresorhus / open

Open stuff like URLs, files, executables. Cross-platform.
MIT License
3.18k stars 219 forks source link

It doesn't fall back to other binaries when `wait: false` #301

Open x-yuri opened 1 year ago

x-yuri commented 1 year ago

I don't have google-chrome, but I have chromium.

const open = require('open');
open('https://google.com', {
    app: {name: open.apps.chrome},
    // wait: true,
});
$ npm i open@8.4.2
$ node index.js
node:events:490
      throw er; // Unhandled 'error' event
      ^

Error: spawn google-chrome ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn google-chrome',
  path: 'google-chrome',
  spawnargs: [ 'https://google.com' ]
}

Node.js v19.6.1

The relevant part of the code.