npm install -g @vue/cli # OR yarn global add @vue/cli
验证
1 2
$ vue --version @vue/cli 4.4.6
快速原型开发
依赖
1 2
@vue/cli @vue/cli-service-global
安装
1
npm install -g @vue/cli-service-global
指令
vue serve 开发环境启动命令
1 2 3 4 5 6 7 8 9 10
$ vue serve --help Usage: serve [options] [entry]
serve a .js or .vue file in development mode with zero config
Options: -o, --open Open browser -c, --copy Copy local url to clipboard -p, --port <port> Port used by the server (default: 8080 or next available port) -h, --help output usage information
vue build 线上版本构建
1 2 3 4 5 6 7 8 9 10
$ vue build --help Usage: build [options] [entry]
build a .js or .vue file in production mode with zero config
Options: -t, --target <target> Build target (app | lib | wc | wc-async, default: app) -n, --name <name> name for lib or web-component mode (default: entry filename) -d, --dest <dir> output directory (default: dist) -h, --help output usage information
$ vue --help 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 [options] [entry] serve a .js or .vue file in development mode with zero config build [options] [entry] build a .js or .vue file in production mode with zero config 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
Options: -p, --preset <presetName> Skip prompts and use saved or remote preset -d, --default Skip prompts and use default preset -i, --inlinePreset <json> Skip prompts and use inline JSON string as preset -m, --packageManager <command> Use specified npm client when installing dependencies -r, --registry <url> Use specified npm registry when installing dependencies (only for npm) -g, --git [message] Force git initialization with initial commit message -n, --no-git Skip git initialization -f, --force Overwrite target directory if it exists --merge Merge target directory if it exists -c, --clone Use git clone when fetching remote preset -x, --proxy Use specified proxy when creating project -b, --bare Scaffold project without beginner instructions --skipGetStarted Skip displaying "Get started" instructions -h, --help output usage information