Vue Cli3

Posted on  by admin

1、首先卸载旧版本(如果事先安装了vue cli1.x或者vue cli2.x,要先卸载掉)npm uninstall vue-cli -g. 2、node版本要要求You are using Node v6.11.0, but this version of vue-cli requires Node >=8.9.2.1、node版本管理nvm 或者 n参考:n参考:nvm.

3、安装Vue clinpm install -g @vue/cli. 4、查看Vue cli的版本vue --version应该是3.xxx.

1、首先安装扩展npm install -g @vue/cli-service-global或者yarn global add @vue/cli-service-global.


2、安装完之后,创建一个App.vue,执行命令vue serve App.vue这样就可以启动这个App.vue文件了.



3、打包命令npm run build. 1、创建项目vue create vue-cli3(这里的vue-cli3是文件名,可以根据需求自己起)如果没有这个文件夹,系统会给自动创建. 一开始只有两个选项: default(默认配置)和Manually select features(手动配置)默认配置只有babel和eslint其他的都要自己另外再配置,所以我们选第二项手动配置。在每次选择手动配置之后,会询问你是否保存配置,也就是图片中的koro选项,这样以后我们在进行创建项目的时候只需使用原先的配置就可以了,而不用再进行配置。3.


1、首先启动图形化界面vue ui(全局命令,可以在任何文件夹下打开). Some global configurations for @vue/cli, such as your preferred package manager and your locally saved presets, are stored in a JSON file named .vuerc in your home directory. You can edit this file directly with your editor of choice to change the saved options. You can also use the vue config command to inspect or modify the global CLI config.


See the Browser Compatibility section in guide.


vue.config.js is an optional config file that will be automatically loaded by @vue/cli-service if it's present in your project root (next to package.json).


You can also use the vue field in package.json, but do note in that case you will be limited to JSON-compatible values only.


The file should export an object containing options:.


Deprecated since Vue CLI 3.3, please use publicPath instead.


The base URL your application bundle will be deployed at (known as baseUrl before Vue CLI 3.3).


This is the equivalent of webpack's output.publicPath, but Vue CLI also needs this value for other purposes, so you should always use publicPath instead of modifying webpack output.publicPath.


By default, Vue CLI assumes your app will be deployed at the root of a domain, e.g.



https://www.my-app.com/. If your app is deployed at a sub-path, you will need to specify that sub-path using this option.


For example, if your app is deployed at https://www.foobar.com/my-app/, set publicPath to '/my-app/'.

The value can also be set to an empty string ('') or a relative path (./) so that all assets are linked using relative paths.