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
- fix: fix `vue add router` command in v3 projects fixes #4692 — committed to sodatea/vue-cli by sodatea 5 years ago
- fix: fix `vue add router` command in v3 projects (#4698) fixes #4692 — committed to vuejs/vue-cli by sodatea 5 years ago
经过对比,我发现了:在不同电脑上的环境(node+vue)相同,但是“vue ui”的预设选项不一样!
@vue/cli
vue ui
的预设只有3个,没有最新的installui
@vue/cli
后多了很多行的提示,类似“加入我们等等”,之前没有的提示。node postinstall || echo "ignore"
(如果需要我提供此全部的提示,需要等到7点下班后了) (并且,我也想尝试在命令行下创建项目,观察有没有installui预设)vue ui
的预设有4个12.10.0
环境后没有出现上面(Windows10)提到的情况。最后,昨天我提出的
经尝试,是没有问题的!(可能是需要重启电脑或者是浏览器的一些行为导致)
😂这是 bug
没主动动过这块代码,在 Mac 下也没发现问题,我晚上再用 Windows 看看……
我看到升级到4.0.3了,能够正常创建项目了! 另外,我测试了一些其他情况: 版本:4.0.3 Node:10.16.3 过程:
"vue-router": "^3.0.6"
;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:
You should review these changes with git diff and commit them.
vue-router
成功,不但自动生成router文件,而且可以正常使用!接下来 接下来选择vuex
按钮,是一次就成功了!其他: 启动
vue ui
,切换菜单到“创建项目”,每次都是在C盘目录下?对比以前:记录上一次的目录。如果以上是新版本的特性,请忽略我的建议! 最后,辛苦大大们了!(^o^)/~
正常使用了,感谢!! (*´v`)
我又尝试了一遍预设,“默认预设”还是一样的问题
vue-cli 4.0.1 构建时 也出现以上bug