Angular CLI - ng deploy Command



The ng deploy command deploys an Angular project. Specifying the project name is totally optional. If you want, specify it from the projects section in the angular.json file. Before using this command, you have to add a deployment package using ng add, which sets up deployment capabilities for your chosen platform and updates the configuration file with a deployment builder.

Syntax

The syntax of ng deploy command is as follows −

ng deploy ng [project][options]

Arguments

The ng deploy command accepts a single argument:

Sr.No. Argument & Syntax Description
1 The name of the application to be deployed.

Options

Following are the optional parameters of ng deploy command −

Sr.No. Option & Syntax Description
1 --configuration Alias c A comma-separated list of one or more named builder configurations.
2 --help When used, it shows a short description of this command in the console.

Example

To deploy an angular application, the target package should be added beforehand using ng add command. If the target is not specified for the project, the ng deploy command will return the following result in the console −

> ng deploy
Cannot find "deploy" target for the specified project.
You can add a package that implements these capabilities.

For example:
  Amazon S3: ng add @jefiozie/ngx-aws-deploy
  Firebase: ng add @angular/fire
  Netlify: ng add @netlify-builder/deploy
  GitHub Pages: ng add angular-cli-ghpages

Would you like to add a package with "deploy" capabilities now? (Use arrow keys)
  No
  Amazon S3
  Firebase
  Netlify
  GitHub Pages

We chose GitHub Pages:

Would you like to add a package with "deploy" capabilities now? GitHub Pages
✔ Determining Package Manager
  › Using package manager: npm
✔ Searching for compatible package version
  › Found compatible package version: [email protected].
✔ Loading package information from registry
✔ Confirming installation
✔ Installing package
UPDATE angular.json (2820 bytes)
Advertisements