vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.78k stars 6.33k forks source link

vue ui Error: spawn /usr/bin/chromium ENOENT #5979

Open xxRockOnxx opened 3 years ago

xxRockOnxx commented 3 years ago

Version

4.5.7

Reproduction link

https://codesandbox.io/s/relaxed-merkle-2xwdp

Environment info

  System:
    OS: Linux 5.8 Arch Linux
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 14.12.0 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.7 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 81.0
  npmPackages:
    @vue/cli-overlay:  4.5.7 
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.7 
    @vue/cli-plugin-router: ~4.5.0 => 4.5.7 
    @vue/cli-plugin-vuex:  4.5.7 
    @vue/cli-service: ~4.5.0 => 4.5.7 
    @vue/cli-shared-utils:  4.5.7 
    @vue/compiler-core:  3.0.1 
    @vue/compiler-dom:  3.0.1 
    @vue/compiler-sfc: ^3.0.0 => 3.0.1 
    @vue/compiler-ssr:  3.0.1 
    @vue/component-compiler-utils:  3.2.0 
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0 
    @vue/preload-webpack-plugin:  1.1.2 
    @vue/reactivity:  3.0.1 
    @vue/runtime-core:  3.0.1 
    @vue/runtime-dom:  3.0.1 
    @vue/shared:  3.0.1 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^7.0.0-0 => 7.0.1 
    vue: ^3.0.0 => 3.0.1 
    vue-eslint-parser:  7.1.1 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  15.9.3 (16.0.0-beta.8)
    vue-router: ^4.0.0-0 => 4.0.0-beta.13 
    vue-style-loader:  4.1.2 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

What is expected?

It should work as described in the docs.

What is actually happening?

Gives

vue ui       
🚀  Starting GUI...
🌠  Ready on http://localhost:8000
events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: spawn /usr/bin/chromium ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:464:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
    at onErrorNT (internal/child_process.js:464:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /usr/bin/chromium',
  path: '/usr/bin/chromium',
  spawnargs: [ 'http://localhost:8000' ]
}

This is just a fresh project created via vue-cli.

fangbinwei commented 3 years ago

It seems vue ui failed to open browser, and it doesn't catch the error. Maybe relate to https://github.com/sindresorhus/open/issues/144

https://github.com/sindresorhus/open/blob/37a769d6073862ab4a46c00b1a21b2ba814e68cf/xdg-open#L929 (or depends on Desktop Environments on Linux)

xxRockOnxx commented 3 years ago

Just to be clear, I do have Google Chrome but not Chromium.

Is vue ui hardcoded to open up chromium or is it from its dependencies? I tried looking for it but wasn't able to find anything related to what handles the command.

fangbinwei commented 3 years ago

Could you test this shell script ? vue ui open URL with default browser by this package.

Bigeard commented 3 years ago

export BROWSER=/usr/bin/%YOUR_WEB_BROWSER%