Angular2的环境构筑

1.nodejs安装
 
npm config set prefix=" D: odejs ode_modules pm ode_global_modules "
npm config set cache=" D: odejs ode_modules pm ode_cache "
 
2.用户环境变量里添加
  Path-> ode ode-global(设定的prefix)
ps:在系统环境变量里添加
  NODE_PATH: ode ode-global ode_modules
在系统环境变量path里添加  ode
 
3.在cmd下输入node -v
 
4.在cmd下输入npm -v
 
5.由于angular2是基于typescript构建,所以我们必须安装typescript
  npm install -g typescript typings
 
6.npm install -g angular-cli
 
7.使用 angular-cli 新建一个 AngularJs2 项目(如果没有在全局环境变量的path下设定node的话,ng也许会报错,这样在对应的node的路径下可以使用ng)
  ng new hello-world
 
8.使用 angular-cli 启动简易服务器来测试项目
  ng server(注意:一定要在你建的项目下执行)
 
9.打开[http://localhost:4200](http://localhost:4200)进行访问
 
注意添加代理:etc/npmrc
    proxy=
    https-proxy=
 
注意:如果实在github上下载的别人的项目
下载项目并解压到你的项目目录下
cd  你项目所在的目录
npm install
npm start
 
npm uninstall -g @angular/cli
npm cache verify/npm cache clean
npm install -g @angular/cli@1.5.2
npm install -g @angular/cli@1.5.2 npm --registry=https://registry.npm.taobao.org
原文地址:https://www.cnblogs.com/wzhw2015/p/12318256.html