vue-cli: vue ui not working

Version

3.4.0

Environment info

Environment Info:

  System:
    OS: macOS 10.14.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Binaries:
    Node: 11.9.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.7.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 64.0
    Safari: 12.0.2
  npmPackages:
    @vue/cli:  3.4.0
  npmGlobalPackages:
    @vue/cli: 3.4.0

Steps to reproduce

vue ui command does not start with an error.

$ vue ui
internal/modules/cjs/loader.js:611
    throw err;
    ^

Error: Cannot find module 'core-js/proposals/array-flat-and-flat-map'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
    at Function.Module._load (internal/modules/cjs/loader.js:535:25)
    at Module.require (internal/modules/cjs/loader.js:663:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@vue/cli/node_modules/apollo-env/lib/polyfills/array.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:734:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
    at Module.load (internal/modules/cjs/loader.js:626:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
    at Function.Module._load (internal/modules/cjs/loader.js:558:3)

What is expected?

vue ui will start without errors.

What is actually happening?

Necessary modules are missing.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 18 (3 by maintainers)

Most upvoted comments

you guys can try:npm install -g core-js@3.0.0-beta.11 ,it’s work for me!

Seems apollo-env has fixed this problem in https://github.com/apollographql/apollo-tooling/issues/962#issuecomment-460015427 Try npm i -g @vue/cli reinstall vue cli to update the dependencies, and vue ui work fine

This issue has been resolved. Thanks!

$ npm install -g @vue/cli && vue ui
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js
+ @vue/cli@3.4.0
updated 1 package in 4.664s
🚀  Starting GUI...
🌠  Ready on http://localhost:8000

It’s a bug in apollo-env

After trying all the different solutions proposed above, it seems that removing the node_modules and then running npm build worked for me!

怎么修复呢?安装3.0低版本的cli?