1.基本环境搭建

安装Node.js和npm

首先,从Node.js官网下载对应平台的安装程序,在Windows上安装时务必选择全部组件,包括勾选Add to Path,npm已经在Node.js安装的时候顺带装好了.

C:\Users\Hugo>node -v

v10.14.1

C:\Users\Hugo>npm -v

6.4.1

安装Yarn

C:\Users\Hugo>npm install -g yarn

C:\Users\Hugo>yarn -v

1.12.3

国内源镜像加速

C:\Users\Hugo>yarn config set registry https://registry.npm.taobao.org
yarn config v1.12.3
success Set "registry" to "https://registry.npm.taobao.org".
Done in 0.03s.

添加模块

C:\Users\Hugo>yarn add chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

安装vue-cli

C:\Users\Hugo>yarn global add vue-cli

vue命令还无法使用,需要进行path配置

C:\Users\Hugo>yarn global dir

C:\Users\Hugo\AppData\Local\Yarn\Data\global

C:\Users\Hugo\AppData\Local\Yarn\bin加入path

就可以使用vue命令了

C:\Users\Hugo>vue

Usage: vue <command> [options]

Options:

  -V, --version  output the version number

  -h, --help    output usage information

Commands:

  init          generate a new project from a template

  list          list available official templates

  build          prototype a new project

  create        (for v3 warning only)

  help [cmd]    display help for [cmd]

 

猜你喜欢

转载自www.cnblogs.com/mldonkey/p/10092808.html