安装包准备
直接官网下载node.js就可以了https://nodejs.org/en/
下载最新版本的Git地址:https://git-scm.com/downloads
可以用淘宝的开发源
https://developer.aliyun.com/mirror/NPM?from=tnpm
设置加速
git config--globalhttps.proxy[http://127.0.0.1:1080](http://127.0.0.1:1080/)git config--globalhttps.proxy[https://127.0.0.1:1080](https://127.0.0.1:1080/)
取消加速
git config--global--unsethttp.proxygit config--global--unsethttps.proxy
如果你的git在操作时遇到网络非常慢的情况,那么试试不妨看
这个npm时候很多包不能下载,需要输入命令
npm config set registry=http://registry.npm.taobao.org
配置镜像站
同时关闭npm的https(取消npm的https认证)!很多时候cnpm没有反应或者npm没有反应是因为这个!
npm config set strict-ssl false
输入命令npm config list 显示所有配置信息,我们关注一个配置文件
C:\Users\Administrator\.npmrc
disturl=https://npm.taobao.org/dist
registry=http://registry.cnpmjs.org/
strict-ssl=false


使用文本编辑器编辑它,可以看到刚才的配置信息


安装VUE
命令:npm install vue -g
这里的-g是指安装到global全局目录去


NPM安装vue-router
命令:npm install vue-router -g


运行npm install vue-cli -g安装vue脚手架


编辑环境编辑path

对path环境变量添加D:\nodejs\node_global
win10以下版本的,横向显示PATH的,注意添加到最后时,不要有分号【;】

重新打开CMD,并且测试vue是否使用正常

注意,vue-cli工具是内置了模板包括 webpack 和 webpack-simple,前者是比较复杂专业的项目,
他的配置并不全放在根目录下的 webpack.config.js 中

初始化,安装依赖

运行npm install安装依赖


成功界面,提示打开地址http://localhost:8080

自动打开浏览器http://localhost:8080/#/
npm run build
生成静态文件,打开dist文件夹下新生成的index.html文件
nmp下新建出来的vue01的目录描述:

网友评论