本文讲述windows 10 64bit系统中,vue环境的搭建。
nodejs环境
安装
下载地址为:http://npm.taobao.org/mirrors/node/v14.15.0/, 下载安装包为node-v14.15.0-x64.msi
。
双击,根据提示安装。默认已设置好PATH。
更新npm源为taobao:
1 | npm config set registry https://registry.npm.taobao.org |
出现metrics-registry = "https://registry.npm.taobao.org/"
表示已设置成功。可设置其它配置项的值:
1 | npm set cache "E:\\Program Files\\nodejs\\node_cache" |
把E:\\Program Files\\nodejs\\npm_prefix
加入到 PATH 变量中。否则,安装的包会提示找不到。
安装 cnpm
1 | npm install -g cnpm --registry=https://registry.npm.taobao.org |
安装 vue
1 | cnpm install vue -g |
简单工程及访问
根据官方模板创建工程:
1 | vue init webpack-simple hellovue // 一路按回车,用默认值 |
安装依赖并运行:
1 | cd hellovue |
使用浏览器访问:http://localhost:8080/ 即可看到默认界面。
打包:
1 | npm run build |
李迟 2020.11.10 周二 晚