Angular CLI configuration in Mac environment
Step 1: Install nodejs
Download and install nodejs on the nodejs official website
Step 2: Install Alibaba’s npm alternative tool cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
Copy after login
Step 3: Install Angular CLI
cnpm install -g @angular/cli
Copy after login
Step4: Set cnpm as the default package management tool
ng set --global packageManager=cnpm
Copy after login
Step5: Create new angular Project
ng new my-app
Copy after login
Step6: Start the project
cd my-app //进入工程目录
ng serve –open //启动工程
Copy after login
Enter localhost: 4200 in the browser, and the following picture will be displayed, that is, the service is started
Note: If an error is reported in
The “@angular/compiler-cli” package was not properly installed
rm –rf node_modules //删除node_modules
cnpm intall //重新执行安装模块
ng serve –open //最后启动工程
Copy after login
The above is the detailed content of How to configure Angular CLI in Mac environment. For more information, please follow other related articles on the PHP Chinese website!