vue-cli: 4.0.1“vue ui” - Error in creating new project and installing Vue-cli on another computer

Version

4.0.1

Environment info

 System:
   OS: Windows 7
   CPU: (4) x64 Intel(R) Core(TM) i3-7100 CPU @ 3.90GH
 Binaries:
   Node: 12.10.0 - C:\Program Files\nodejs\node.EXE
   Yarn: Not Found
   npm: 6.10.3 - C:\Program Files\nodejs\npm.CMD
 npmPackages:
   @vue/babel-helper-vue-jsx-merge-props:  1.0.0
   @vue/babel-plugin-transform-vue-jsx:  1.0.0
   @vue/babel-preset-app:  4.0.0
   @vue/babel-preset-jsx:  1.1.1
   @vue/babel-sugar-functional-vue:  1.0.0
   @vue/babel-sugar-inject-h:  1.0.0
   @vue/babel-sugar-v-model:  1.1.1
   @vue/babel-sugar-v-on:  1.1.0
   @vue/cli-overlay:  4.0.0
   @vue/cli-plugin-babel: ^4.0.0 => 4.0.0
   @vue/cli-plugin-eslint: ^4.0.0 => 4.0.1
   @vue/cli-service: ^4.0.0 => 4.0.0
   @vue/cli-shared-utils:  4.0.0
   @vue/component-compiler-utils:  3.0.0
   @vue/preload-webpack-plugin:  1.1.1
   @vue/web-component-wrapper:  1.2.0
   eslint-plugin-vue: ^5.0.0 => 5.2.3
   vue: ^2.6.10 => 2.6.10
   vue-eslint-parser:  5.0.0
   vue-hot-reload-api:  2.3.4
   vue-loader:  15.7.1
   vue-router: ^3.1.3 => 3.1.3
   vue-style-loader:  4.1.2
   vue-template-compiler: ^2.6.10 => 2.6.10
   vue-template-es2015-compiler:  1.9.1
 npmGlobalPackages:
   @vue/cli: Not Found

Steps to reproduce

1.Unload and empty Vue 2.Install Vue-cli 3.Create a new project using “vue ui” 4.If you can continue, select the “Vue router” button in the “plugin” menu.

What is expected?

Create and run projects

What is actually happening?

failed


Wrong information:
� Starting GUI…
� Ready on http://localhost:8000
removed 1 package in 31.525s
TypeError: apply is not a function
at C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modules@vue\cli\lib\Gener ator.js:103:7
at Array.forEach (<anonymous>)
at new Generator (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modules@vu e\cli\lib\Generator.js:101:13)
at Function.runGenerator (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_mod ules@vue\cli\lib\invoke.js:123:21)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async install (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modules@vu e\cli\node_modules@vue\cli-ui\ui-defaults\suggestions.js:82:5)
at async Object.handler (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modu les@vue\cli\node_modules@vue\cli-ui\ui-defaults\suggestions.js:32:13)
at async Object.activate (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_mod ules@vue\cli\node_modules@vue\cli-ui\apollo-server\connectors\suggestions.js:8 2:14)

Wrong information:
� Starting GUI…
� Ready on http://localhost:8000
ERROR Error: Cannot resolve plugin router from package.json. Did you forget to install it?
Error: Cannot resolve plugin router from package.json. Did you forget to install it?
at invoke (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modules@vue\cli\l ib\invoke.js:58:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async install (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modules@vu e\cli\node_modules@vue\cli-ui\ui-defaults\suggestions.js:80:5)
at async Object.handler (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_modu les@vue\cli\node_modules@vue\cli-ui\ui-defaults\suggestions.js:18:13)
at async Object.activate (C:\Users*\AppData\Roaming\nvm\v12.10.0\node_mod ules@vue\cli\node_modules@vue\cli-ui\apollo-server\connectors\suggestions.js:8 2:14)

About this issue

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

Commits related to this issue

Most upvoted comments

原因:在DOS窗口里,必须手动确认加载vue-router之后才是完整的步骤。

这是 bug

启动vue ui,切换菜单到“创建项目”,每次都是在C盘目录下?对比以前:记录上一次的目录。

没主动动过这块代码,在 Mac 下也没发现问题,我晚上再用 Windows 看看……

经过对比,我发现了:在不同电脑上的环境(node+vue)相同,但是“vue ui”的预设选项不一样!

  1. Windows10(专业版)
  • node,10.16.3
  • @vue/cli, 4.0.3
  • 区别,重新搭建的node,安装@vue/cli
  • 区别,vue ui的预设只有3个,没有最新的installui
  • 另外,当安装@vue/cli后多了很多行的提示,类似“加入我们等等”,之前没有的提示。 node postinstall || echo "ignore" (如果需要我提供此全部的提示,需要等到7点下班后了) (并且,我也想尝试在命令行下创建项目,观察有没有installui预设)
  1. Windows7(专业版)
  • node,10.16.3,也尝试了12.10.0
  • @vue/cli, 4.0.3
  • 区别,旧版本升级
  • 区别,vue ui的预设有4个
  • 并且,切换到12.10.0环境后没有出现上面(Windows10)提到的情况。

最后,昨天我提出的

启动vue ui,切换菜单到“创建项目”,每次都是在C盘目录下?对比以前:记录上一次的目录。

经尝试,是没有问题的!(可能是需要重启电脑或者是浏览器的一些行为导致)

原因:在DOS窗口里,必须手动确认加载vue-router之后才是完整的步骤。

😂这是 bug

启动vue ui,切换菜单到“创建项目”,每次都是在C盘目录下?对比以前:记录上一次的目录。

没主动动过这块代码,在 Mac 下也没发现问题,我晚上再用 Windows 看看……

直接在3.x的旧项目里点右上角按钮运行好像还是有问题,先升级项目或者先用命令行吧

我看到升级到4.0.3了,能够正常创建项目了! 另外,我测试了一些其他情况: 版本:4.0.3 Node:10.16.3 过程:

  1. 使用“vue ui”创建“默认预设”的项目,选择“vue-router”的按钮之后:
  • 必须刷新页面才会加载“插件列表”,对比以前是自动加载;
  • 安装后,在package和package-lock里新添了"vue-router": "^3.0.6"
  • 但是,此项目不存在此插件,不能使用;
  1. 最终我发现了原因,并且我猜测这可能是新版本的特性! 原因:在DOS窗口里,必须手动确认加载vue-router之后才是完整的步骤。 DOS:

� Installing @vue/cli-plugin-router

? Use history mode for router? (Requires proper server setup for index fallback in production)

YES

� Invoking generator for @vue/cli-plugin-router… � Installing additional dependencies…

added 1 package from 1 contributor in 8.392s ⚓ Running completion hooks…

✔ Successfully invoked generator for plugin: @vue/cli-plugin-router The following files have been updated / added:

 src/router/index.js
 src/views/About.vue
 src/views/Home.vue
 package-lock.json
 package.json
 src/App.vue
 src/main.js

You should review these changes with git diff and commit them.

  1. 安装vue-router成功,不但自动生成router文件,而且可以正常使用!接下来 接下来选择vuex按钮,是一次就成功了!

其他: 启动vue ui,切换菜单到“创建项目”,每次都是在C盘目录下?对比以前:记录上一次的目录。

如果以上是新版本的特性,请忽略我的建议! 最后,辛苦大大们了!(^o^)/~

直接在3.x的旧项目里点右上角按钮运行好像还是有问题,先升级项目或者先用命令行吧

正常使用了,感谢!! (*´v`)
我又尝试了一遍预设,“默认预设”还是一样的问题

  • 版本:4.0.2
  • 过程:全部新建项目
  • 命令:vue ui
  1. installui:正常;
  2. 默认:依旧存在问题,点击安装按钮(vue-router和vuex)出现第二个“Wrong information”的报错信息 建议隐藏预设,如果不再需要;
  3. 手动:正常。

vue-cli 4.0.1 构建时 也出现以上bug