Get the App
SLTechnology News&Howtos  ›  Servers  › 

Environment Building and frequently asked questions for the latest version of angular2.0

Shulou Source: shulou.com Published: 2022-06-02 09:02:35 10月03日 Update

Step 1: install Node.js,npm (npm is automatically installed when you install Node.js)

Part 2: install npm. Because the npm official website image access is too slow, we use the npm image of Taobao in the node command window (windows's cmd, linux's terminal) $npm install-g cnpm-- registry= https://registry.npm.taobao.org

Part III: set Taobao image, temporarily switch npm source to taobao source (faster): npm config set registry https://registry.npm.taobao.org

Part IV: install @ angular/cli scaffolding, $npm install-- save-dev @ angular/cli@latest

Be sure to uninstall clean 1:npm uninstall-g @ angular/cli,2:npm cache clean if the previous installation failed

Fifth: test, enter ng-v, there is version information indicating that the installation is successful

Sixth: create an Angular2 project, create a new folder (young), and then enter the ng new project name (ngtest) on the command line.

This process may wait for a while (it may take a long time, but you must be patient) until the prompt on the last line of the following figure indicates that the framework for the entire project has been built.

When we open the project with webstrom, we can see that the framework contains a lot of content, which is also the advantage of using AngularJS cli. One sentence of code, all the environments of the whole project, have been set up for you.

Seventh: start the project, enter the project directory (ngtest) of the newly created angular2, and show success as shown in the arrow in the figure

Eighth: do not close the command window, open the web page, type: http://localhost:4200/, appear as shown in the picture, finally done

Tags: Project command mirror input success file folder frame Taobao such as picture environment clean patient done one line following figure code information content great achievement Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL NVidia Microsoft macOS