Angular 是一个开源、流行且高度可扩展的前端应用程序开发框架,用于构建移动以及使用 TypeScript 和其他常用语言的 Web 应用程序。它由 Google 于 2010 年 10 月 20 日开发,目前由 Google 和其他个人和公司维护。angular-logoangular-logo

在 Debian 11 Bullseye 上安装 AngularJS

apt步骤 1. 在我们安装任何软件之前,通过在终端中运行以下命令来确保您的系统是最新的,这一点很重要:

sudo apt update
sudo apt upgrade

步骤 2. 安装 Node.js。

现在我们在 Debian Bullseye 上手动添加官方 Node.js 存储库:

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -

成功添加存储库后,您现在可以使用以下命令安装 Node.js:

sudo apt install nodejs

验证 Node.js 和 NPM 版本:

$ node -v
v14.18.4

$ npm --version
6.14.16

步骤 3. 在 Debian 11 上安装 AngularJS。

现在我们运行以下命令来安装 AngularCLI:

sudo npm install -g @angular/cli

验证 AngularJS 安装:

ng --version

输出:

/ \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \\ | \'_ \\ / _` | | | | |/ _` | \'__|   | |   | |    | |
  / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|
                |___/


Angular CLI: 12.2.22
Node: 14.8.0
OS: linux x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.801.7
@angular-devkit/core         12.2.22
@angular-devkit/schematics   12.2.22
@schematics/angular          12.2.22
@schematics/update           0.801.3
rxjs                         6.4.0

第 4 步。创建 Angular 应用程序。

现在使用以下命令创建一个新的 AngularCLI 项目:

ng new [new-project-name]

接下来,访问使用项目名称创建的文件夹:

cd [new-project-name]

要测试所有内容,请运行:

ng serve

您可以通过提供 –host 和 –port 命令行参数来更改运行 Angular 应用程序的主机和端口:

ng serve – host [host_ip] – port [port]

步骤 5. 访问 Angular 应用程序。

成功创建项目后,打开 Web 浏览器并导航 URL ,您将看到以下内容:http://your-IP-address:4200

Angular-web-interfaceAngular-web-interface

感谢您使用本教程在 Debian 11 Bullseye 上安装最新版本的 AngularJS。如需更多帮助或有用信息,我们建议您查看官方 AngularJS 网站。