vuejs / vue-cli

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

Unable to open the default browser during project startup 无法在项目启动时打开默认浏览器 #7415

Closed willow970898719 closed 1 year ago

willow970898719 commented 1 year ago

Version

5.0.8

Reproduction link

github.com

Environment info

 System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz
  Binaries:
    Node: 16.19.0 - D:\InstallationPath\Nodejs\node.EXE
    Yarn: Not Found
    npm: 8.19.3 - D:\InstallationPath\Nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.200), ChromiumDev (117.0.2024.1)
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.4.0 
    @vue/babel-helper-vue-transform-on:  1.1.5 
    @vue/babel-plugin-jsx:  1.1.5 
    @vue/babel-plugin-transform-vue-jsx:  1.4.0 
    @vue/babel-preset-app:  5.0.8 
    @vue/babel-preset-jsx:  1.4.0 
    @vue/babel-sugar-composition-api-inject-h:  1.4.0 
    @vue/babel-sugar-composition-api-render-instance:  1.4.0 
    @vue/babel-sugar-functional-vue:  1.4.0 
    @vue/babel-sugar-inject-h:  1.4.0 
    @vue/babel-sugar-v-model:  1.4.0 
    @vue/babel-sugar-v-on:  1.4.0 
    @vue/cli-overlay:  5.0.8 
    @vue/cli-plugin-babel: ~5.0.0 => 5.0.8 
    @vue/cli-plugin-eslint: ~5.0.0 => 5.0.8 
    @vue/cli-plugin-router:  5.0.8 
    @vue/cli-plugin-vuex:  5.0.8 
    @vue/cli-service: ~5.0.0 => 5.0.8 
    @vue/cli-shared-utils:  5.0.8
    @vue/compiler-sfc:  2.7.14
    @vue/component-compiler-utils:  3.3.0
    @vue/web-component-wrapper:  1.3.0
    eslint-plugin-vue: ^8.0.3 => 8.7.1
    vue: ^2.6.14 => 2.7.14
    vue-eslint-parser:  8.3.0
    vue-hot-reload-api:  2.3.4
    vue-loader:  17.2.2 (15.10.1)
    vue-style-loader:  4.1.3
    vue-template-compiler: ^2.6.14 => 2.7.14
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

我使用的是最新5.0.8版本的vue-cli, 通过命令vue create创建一个vue2项目, 想要在项目启动时打开默认浏览器,但是尝试了以下方式都无效

  1. 尝试通过在package.json中通过命令 vue-cli-service serve --open 启动项目
  2. 运行时执行命令 npm run serve --open
  3. 在vue.config.js中配置devServer: { open: true } 以上三种方法都无法在项目启动时打开默认浏览器,所使用的编辑器是vscode, 已经排除是编辑器的问题

What is expected?

在运行项目时自动打开默认浏览器

What is actually happening?

无法自动打开默认浏览器