命令 vue init 需要一个全局插件 [英] Command vue init requires a global addon

查看:26
本文介绍了命令 vue init 需要一个全局插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试 vue init webpack test-app 时,出现以下错误:

When I tried to vue init webpack test-app, I got the following error:

Command vue init requires a global addon to be installed.
Please run npm install -g @vue/cli-init and try again.

这就是我安装 vue cli v3 beta6
npm install -g @vue/cli

This is what I did to install vue cli v3 beta6
npm install -g @vue/cli

这是我遵循的教程
https://itnext.io/getting-started-vue-js-and-visual-studio-code-6990f92e918a

显然,本教程不需要安装@vue/cli-init.我想知道为什么以及如何解决这个问题.

Apparently, the tutorial does not need to install @vue/cli-init. I am wondering why and how to solve this issue.

旁注:当我像这样安装 npm install -g vue-cli 时,它按预期工作.我发现 vue-cli 是一个稳定的 2.9.x 版本.

Side Notes: When I install like this npm install -g vue-cli it works as expected. I have found that vue-cli is a stable 2.9.x version.

非常感谢!

推荐答案

vue-cli repository 我看到了两种不同的搭建 vue 项目的方法.

Looking at vue-cli repository I see two different ways of scaffolding vue projects.

v3(测试版)安装为 npm install -g @vue/cli,使用以下命令创建项目:

The v3 (beta) version, installed as npm install -g @vue/cli, creates projects using the following command:

vue create my-project

虽然版本 2.9.x,可在 master 分支获得,安装为 npm install -g vue-cli 并且它允许项目脚手架如下:

While the version 2.9.x, available at master branch, is installed as npm install -g vue-cli and it allows projects scaffolding with the following:

vue init <template-name> <project-name>

例如:

vue init webpack my-project

因此,在您的场景中,对于 v3 版本,您应该使用:vue create test-app.

So, in your scenario, for v3 version you should use: vue create test-app.

此处您可以找到更多信息.

这篇关于命令 vue init 需要一个全局插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆