我想通过npx而不是全局地为我的项目安装vue,并确保我具有最新版本的vue.js,就像在react中一样。终端中实现该命令的命令是什么?
答案 0 :(得分:26)
Vue CLI(@vue/cli
)是等效的程序包,可以与npx
一起运行,如下所示:
npx @vue/cli create --default my-project
从v4.1.2开始的用法输出:
$ npx @vue/cli --help
Usage: vue <command> [options]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
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
info print debugging information about your environment
Run vue <command> --help for detailed usage of given command.
请注意,安装过程需要花费几秒钟的时间,因此值得在本地安装。