vuejs / vue-cli

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

vue-cli-service serve --open didn't work when "Yarn Not Found" but yarn.lock exist #7416

Open GoodZige opened 1 year ago

GoodZige commented 1 year ago

Version

5.0.8

Reproduction link

github.com

Environment info

  System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  Binaries:
    Node: 14.8.0 - D:\Program Files\gnvm-bin-master\node.EXE
    Yarn: Not Found
    npm: 6.14.7 - D:\Program Files\gnvm-bin-master\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.200)
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1
    @vue/babel-plugin-transform-vue-jsx:  1.2.1
    @vue/babel-preset-app:  3.12.1
    @vue/babel-preset-jsx:  1.2.4
    @vue/babel-sugar-composition-api-inject-h:  1.2.1
    @vue/babel-sugar-composition-api-render-instance:  1.2.4
    @vue/babel-sugar-functional-vue:  1.2.2
    @vue/babel-sugar-inject-h:  1.2.2
    @vue/babel-sugar-v-model:  1.2.3
    @vue/babel-sugar-v-on:  1.2.3
    @vue/cli-overlay:  3.12.1
    @vue/cli-plugin-babel: ^3.8.0 => 3.12.1
    @vue/cli-plugin-eslint: ^3.8.0 => 3.12.1
    @vue/cli-service: ^3.8.0 => 3.12.1
    @vue/cli-shared-utils:  3.12.1
    @vue/component-compiler-utils:  3.3.0
    @vue/preload-webpack-plugin:  1.1.2
    @vue/web-component-wrapper:  1.3.0
    babel-helper-vue-jsx-merge-props:  2.0.3
    eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
    vue: ^2.6.10 => 2.6.14
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.9.8
    vue-router: 3.0.6 => 3.0.6
    vue-style-loader:  4.1.3
    vue-template-compiler: ^2.6.10 => 2.6.14
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.6.0 => 3.6.0
    vuex-persistedstate: ^4.1.0 => 4.1.0
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

npm install
npm run dev

What is expected?

browser open automatically

What is actually happening?

browser didn't open


node_modules\@vue\cli-service\lib\commands\serve.js line 244 - 247 throw error because node_modules\@vue\cli-shared-utils\lib\env.js line 46

function checkYarn (result) {
  if (result && !exports.hasYarn()) {
    // console.error(`The project seems to require yarn but it's not installed.`);// it would be work if use this code
    throw new Error(`The project seems to require yarn but it's not installed.`)// stop open browser
  }
  return result
}