vue实践录:windows 10系统vue环境搭建

本文讲述windows 10 64bit系统中,vue环境的搭建。

nodejs环境

安装

下载地址为:http://npm.taobao.org/mirrors/node/v14.15.0/, 下载安装包为node-v14.15.0-x64.msi
双击,根据提示安装。默认已设置好PATH。

更新npm源为taobao:

1
2
npm config set registry https://registry.npm.taobao.org
npm config list // 查看是否生效

出现metrics-registry = "https://registry.npm.taobao.org/"表示已设置成功。可设置其它配置项的值:

1
2
3
npm set cache "E:\\Program Files\\nodejs\\node_cache"
npm set prefix "E:\\Program Files\\nodejs\\npm_prefix"

E:\\Program Files\\nodejs\\npm_prefix加入到 PATH 变量中。否则,安装的包会提示找不到。

安装 cnpm

1
npm install -g cnpm --registry=https://registry.npm.taobao.org

安装 vue

1
2
cnpm install vue -g
cnpm install vue-cli -g

简单工程及访问

根据官方模板创建工程:

1
vue init webpack-simple hellovue   // 一路按回车,用默认值

安装依赖并运行:

1
2
3
cd hellovue
npm install
npm run dev

使用浏览器访问:http://localhost:8080/ 即可看到默认界面。

打包:

1
npm run build

李迟 2020.11.10 周二 晚