一、環境
1、os:win 10
2、node:node-v12.5.0-x64
3、npm:6.9.0
4、vue:2.9.6
5、Windows PowerShell
二、安裝提示
1、環境檢測
-> npm -v 【版本確認】
-> npm config list -l 【環境配置】
-> npm list -g -depth 0 【已安裝組件】
-> npm cache clean -f 【強制(force)清除緩存,避免干擾】
2、逃坑策略【非常有效】
(1)如果安裝過程中,出現錯誤提示,則:
-> clean後再install,可能重複兩三次。
-> 換如下代理試試,重複上條。
【npm config set registry https://registry.npm.taobao.org】
【npm config set registry http://registry.cnpmjs.org】
(2)安裝成功後,務必查看是否已經安裝成功。
-> npm list -g -depth 0
(3)代理管理
-> npm config set proxy null
-> npm config set https-proxy null
(4)包安裝路徑
-> 全局安裝請使用參數:-g。
-> 單項目安裝,至項目根文件夾:npm install webpack --save-dev
3、安裝步驟
(1)proxy:
-> npm config set registry https://registry.npm.taobao.org
(2)webpack:
-> npm install webpack -g
(3)webpack-cli:
-> npm install webpack-cli -g
(4)webpack-dev-server:
-> npm install webpack-dev-server -g
(5)eslint:
-> npm install eslint –g
-> 【非必須】eslint -v
-> 【非必須】eslint --init 【注意是--】
-> 【非必須】npm install eslint-plugin-vue -g
(6)coffee-script:
-> npm install coffee-script -g 【需要cnpmjs】
-> 【非必須】npm info underscore
3、安裝vue
-> npm install vue-cli -g
-> 【非必須,注意:V要大寫】vue -V
4、創建項目
-> vue init webpack HelloVue
? Project name hellovue
? Project description A Vue.js project
? Author
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No 【ESLint選爲yes會出錯】
? Set up unit tests Yes
? Pick a test runner jest
? Setup e2e tests with Nightwatch? No 【Nightwatch選爲yes會出錯】
5、運行項目
-> npm run dev
-> http://localhost:8080/