ANGULAR-CLI Installation and build Project _ANGULAR2

Source: Internet
Author: User
Tags small web server install node
1. Install Node.js
url:https://nodejs.org/en/download/
Select the appropriate version to install


2. Installing the Angularjs CLI
Angular is written in typescript, so install typescript First, then install ANGULARJS-CLI
NPM install-g typescript typings
NPM install-g angular-cli--ignore-scripts
NPM Install


3.build Project

Under the path that requires a build, run NPM install first, and then run NG builds, where you can generate the Dist folder


Tips
Clear NPM cache: NPM Cached clean
View NPM Source: NPM Config Get registry
Temporarily switch NPM source to Taobao source (faster): NPM Config Set registry https://registry.npm.taobao.org

Settings to view npm progress: NPM config set loglevel=http


-----------------------------------------------------------------------

Installing CLI

NPM install-g ANGULAR-CLI

If you have installed a previous version, perform the following command to update:

NPM uninstall-g ANGULAR-CLI
NPM Cache Clean
NPM install-g Angular-cli@latest

Older versions of the CLI used SYSTEMJS and the most recent creation, based on Webpack builds.

Older versions of ANGULAR2 (RC1-RC6) can view update steps

The interesting thing here is that after I uninstall ANGULAR-CLI, a build failed error occurred at the time of installation and finally found the reason that uninstall was not uninstalled cleanly. Go to the global directory to delete the relevant NG files.

Common ng Command

ng New Project-name-Creating a new project, setting it as default
ng build-building/Compiling application
ng test-run unit test
ng e2e-run end-to-end (end-to-end) Test
N G serve-launches a small Web server for managed applications
Ng deploy-out-of-the-go, deployed to GitHub pages or firebase
ng generate component My-comp-generates a new component with Generates its test specification and corresponding Html/css file
ng generate directive my-directive-generate a new instruction
ng generate pipe my-pipe-Generate a new pipeline
NG gene Rate Service My-service-Generate a new server
ng generate route My-route-Generate a new route
Ng generate class My-class-Generate a simple model class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.