vue 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

vue cli 命令安装:


-bash/zsh: vue: command not found

npm install -g vue-cli

执行 vue --version 查看 vue cli 版本(注意这个版本已不再维护):

vue --version
2.9.6

升级到新的 Vue CLI 3

npm uninstall -g vue-cli
npm install -g @vue/cli

# OR

yarn global add @vue/cli


#-------------------------
# 再次执行查看 vue 版本
#-------------------------

vue --version
@vue/cli 5.0.8

vue 命令语法:


vue <command> [options]

vue 命令选项:


-V, --version  output the version number
-h, --help     output usage information

vue cli 3 命令创建一个项目:

vue create my-project

# OR

vue ui

vue 命令参数:


create [options] <app-name>                create a new project powered by vue-cli-service
add [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created project
invoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created project
inspect [options] [paths...]               inspect the webpack config in a project with vue-cli-service
serve                                      alias of "npm run serve" in the current project
build                                      alias of "npm run build" in the current project
ui [options]                               start and open the vue-cli ui
init [options] <template> <app-name>       generate a project from a remote template (legacy API, requires @vue/cli-init)
config [options] [value]                   inspect and modify the config
outdated [options]                         (experimental) check for outdated vue cli service / plugins
upgrade [options] [plugin-name]            (experimental) upgrade vue cli service / plugins
migrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugin
info                                       print debugging information about your environment
help [command]                             display help for command  

vue 命令实例:


执行 vue ui 命令,可以图形化界面操作项目管理:

vue ui

Starting GUI...
Ready on http://localhost:8000

vue 命令扩展阅读:




vue 命令评论