一、环境
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/