angular install

angular install

  1. nodejs install

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    [root@dev app]# xz -d node-v8.1.3-linux-x64.tar.xz
    [root@dev app]# tar xf node-v8.1.3-linux-x64.tar
    [root@dev app]# mv node-v8.1.3-linux-x64 /mnt/app/node
    [root@dev app]# chown -R root.root /mnt/app/node

    [root@dev app]# echo 'NODE_HOME=/mnt/app/node' |tee /etc/profile.d/node.sh
    [root@dev app]# echo 'NODE_PATH=${NODE_HOME}/lib/node_modules' |tee -a /etc/profile.d/node.sh
    [root@dev app]# echo 'export PATH=${PATH}:${NODE_HOME}/bin' |tee -a /etc/profile.d/node.sh
    [root@dev app]# source /etc/profile

    [root@dev app]# node -v
    v8.1.3
  2. 修改npm源

    1
    2
    3
    [root@dev app]# echo 'registry = https://registry.npm.taobao.org' > ~/.npmrc
    [root@dev app]# npm -v
    5.0.3
  3. angular install

    1
    [root@dev app]# npm install -g @angular/cli
  4. angular 创建新项目

    1
    [root@dev ~]# ng new my-app
  5. angular 启动开发服务

    1
    2
    3
    4
    [root@dev ~]# cd my-app/
    [root@dev my-app]# ng server --open --host 192.168.13.208 --port 4000

    浏览器中输入:http://192.168.13.208:4000/