准备工作

  1. 安装nodejs
    官网下载nodejs安装包,地址http://nodejs.cn/download/
  2. 修改nodejs默认的缓存文件地址,命令
    1. npm config set cache "D:\software\nodejs\node_cache"
    设置全局模块存放路径;命令
    1. npm config set prefix "D:\software\nodejs\node_global"
  3. 用npm安装typescript和typings,因为据说angular-cli是用typescript写的,所以要先装这两个:
    npm install -g typescript typings

安装angular-cli:

  1. npm install -g @angular/cli

如果你之前安装失败过,最好在安装angular-cli之前先卸载干净,用以下两句:

  1. npm uninstall -g @angular/cli
  2. npm cache clean

新建angular项目

  1. ng new boboBlog

如果提示ng命令不存在,需要把node_global目录添加到环境变量中,path中加上下面路径

  1. D:\software\nodejs\node_global

end