Mac上Angular的环境搭建

安装Angular通常需要以下几个步骤:

  1. 1. 确保你的机器上已经安装了Node.js和npm,这是使用Angular的必要条件。如果没有安装,可以通过官网下载并安装nodejs.org/en/download… 。

  2. 打开终端(Unix / Linux / macOS)或命令提示符(Windows)并输入以下命令安装Angular CLI(命令行工具) :

    npm install -g @angular/cli
  3. 创建一个新的Angular应用程序。在终端中运行以下命令:

    ng new my-app

    这将创建一个名为"my-app"的新应用程序,其中包括Angular框架、基本的文件和文件夹结构和一些默认的样式。这个过程可能需要一些时间,请耐心等待。

  4. 进入刚刚创建的项目目录,并在本地运行开发服务器:

    cd my-app ng serve --open

    运行成功后,你可以在浏览器中访问http://localhost:4200并看到一个默认的Angular欢迎页面。

总的来说,安装Angular需要安装Node.js和npm,然后使用Angular CLI创建一个新的Angular项目,并在本地运行开发服务器以查看你的应用程序。如果出现任何问题,可以查看官方文档或向社区寻求帮助。

要求

  1. Node.js
    下载地址,当然也可以用brew install node来安装。

  2. npm package manager
    当我用brew安装node.js的时候,npm也一并被安装了

安装Angular CLI

npm install -g @angular/cli

配置编辑器

官网的第四步就开始编辑Angular组件了,但工于利其事必先利其器,一个文件一个文件的编辑太麻烦了,咱先把编辑器配置好。
常用的Angular编辑器有Visual Studio Code、WebStorm、Sublime Text


 

Development environment

If you plan to complete this tutorial on your local computer, you must install the required software. If you have already installed some of the required software, you must verify that it is the correct version.

Perform these steps in a command-line tool on the computer you want to use for this tutorial.

IMPORTANT: If you plan to use StackBlitz to do the lessons, you can proceed to the first lesson. You don't need to install any software.

Step 1 - Identify the version of node.js that Angular requires

IMPORTANT: This step is only required if you have a version of node installed, otherwise, proceed to step 2 below.

Angular requires an active LTS or maintenance LTS version of Node. Let's confirm your version of node.js. For information about specific version requirements, see the engines property in the package.json file.

From a Terminal window:

  1. Run the following command: node --version
  2. Confirm that the version number displayed meets the requirements.

Step 2 - Install the correct version of node.js for Angular

If you do not have a version of node.js installed, please follow the directions for installation on nodejs.org

Step 3 - Install the latest version of Angular

With node.js and npm installed, the next step is to install the Angular CLI which provides tooling for effective Angular development.

From a Terminal window:

  1. Run the following command: npm install -g @angular/cli
  2. Once the installation completes, the terminal window will display details of the Angular CLI version installed on your local computer.

Step 4 - Install integrated development environment (IDE)

You are free to use any tool you prefer to build apps with Angular. We recommend the following:

  1. Visual Studio Code
  2. As an optional, but recommended step you can further improve your developer experience by installing the Angular Language Service

你可能感兴趣的:(angular.js,macos,javascript)