Node 版本要求css
Vue CLI 須要 Node.js 8.9 或更高版本 (推薦 8.11.0+)。若是你已經全局安裝了舊版本的 vue-cli
(1.x 或 2.x),你須要先經過 npm uninstall vue-cli -g
或 yarn global remove vue-cli
卸載它。前端
從新安裝vue-cli,將是最新的vue-cli版本
npm install -g @vue/cli
vue --version
查看安裝的版本號,以及是否安裝成功vue
vue create hello-world
default: 默認配置,只有bable和eslintnode
Manually select features: 手動配置 webpack
Babel:將ES6編譯成ES5web
TypeScript:JS超集,主要是類型檢查vue-cli
Progressive Web App(PWA)Support:漸進式WEB應用支持typescript
Router:路由npm
Vuex:狀態管理json
Linter/ Formatter:代碼檢查工具
CSS Pre-processors:css預編譯 (稍後會對這裏進行配置)
Unit Testing:單元測試,開發過程當中前端對代碼進行自運行測試
E2E Testing: 端對端測試,屬於黑盒測試,經過編寫測試用例,自動化模擬用戶操做,確保組件間通訊正常,程序流數據傳遞如預期。
tslint: typescript格式驗證工具(若是前面選擇了TypeScript會有這一項)
eslint w...: 只進行報錯提醒;(若是還沒熟悉eslint,推薦使用此模式)
eslint + A...: 不嚴謹模式;
eslint + S...: 正常模式
eslint + P...: 嚴格模式;
// vue.config.js const path = require('path') const webpack = require('webpack') module.exports = { // baseUrl從vue cli 3.3起已經棄用了,用publicPath來代替 publicPath: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : '/', // 部署應用包時的基本URL(這裏能夠看一下官方說明) outputDir: 'dist', // 打包時生成的生產環境構建穩健的目錄 assetsDir: 'static', // 放置生成的靜態資源的目錄 filenameHashing: true, lintOnSave: true, // eslint-loader會將lint錯誤輸出爲編譯警告 productionSourceMap: false, // 若是你不須要生產環境的source map,能夠將其設置爲false,以加速生產環境的構建 configureWebpack: { // 簡單/基礎配置,好比引入一個新插件 plugins: [] }, chainWebpack: config => { // 鏈式配置 }, css: { // css預設器配置項 loaderOptions: { css: { }, postcss: { } } }, devServer: { open: true, host: '127.0.0.1', port: 8080, https: false, hotOnly: false, proxy: null, // proxy: { // '/api': { // target: '<url>', // ws: true, // changOrigin: true // } // }, before: app => {} }, // 第三方插件配置 pluginOptions: {} }
vue
命令,因此 Vue CLI 2 (vue-cli
) 被覆蓋了。若是你仍然須要使用舊版本的 vue init
功能,你能夠全局安裝一個橋接工具:npm install -g @vue/cli-init # `vue init` 的運行效果將會跟 `vue-cli@2.x` 相同 vue init webpack my-project
cd hellow-world
npm run serve