Angular CLI - ng update Command


Advertisements

This chapter explains the syntax, argument and options of ng update command along with an example.

Syntax

The syntax for ng update command is as follows −

ng update [options]

ng update command updates the application and its dependencies.

Arguments

The argument for ng update command is as follows −

Sr.No. Argument & Syntax Description
1 <keyword> The keyword to search for, as provided in the search bar in angular.io.

Options

Options are optional parameters.

Sr.No. Option & Syntax Description
1 --all=true|false Whether to update all packages in package.json.

Default: false

2 --allowDirty=true|false Whether to allow updating when the repository contains modified or untracked files.
3 --createCommits=true|false

Create source control commits for updates and migrations.

Default: false

Aliases: -C

4 --force=true|false

If false, will error out if installed packages are incompatible with the update.

Default: false

5 --from=from Version from which to migrate from. Only available with a single package being updated, and only on migration only.
6 --help=true|false|json|JSON

Shows a help message for this command in the console.

Default: false

7 --migrateOnly=true|false Only perform a migration, does not update the installed version.
8 --next=true|false

Use the largest version, including beta and RCs.

Default: false

9 --packages The names of package(s) to update.
10 --to=to Version up to which to apply migrations. Only available with a single package being updated, and only on migrations only. Requires from to be specified. Default to the installed version detected.
11 --verbose=true|false

Display additional details about internal operations during execution.

Default: false

First move to an angular project updated using ng build command.The chapter is available at https://www.tutorialspoint.com/angular_cli/angular_cli_ng_build.htm.

Now run the update command. Now ng will update dependencies using npm.

Example

An example for ng update command is given below −

\>Node\>TutorialsPoint> ng update
Using package manager: 'npm'
Collecting installed dependencies...
Found 31 dependencies.
   We analyzed your package.json and everything seems to be in order. Good work!

Useful Video Courses


Video

AngularJS Online Training

16 Lectures 1.5 hours

Anadi Sharma

Video

Angular 2 Online Training

28 Lectures 2.5 hours

Anadi Sharma

Video

Step By Step Angular For Beginnners

11 Lectures 7.5 hours

SHIVPRASAD KOIRALA

Video

Ionic & Angular JS: Principles Of Mobile and Web Development

16 Lectures 2.5 hours

Frahaan Hussain

Video

Angular 8 Full Stack Development With Spring Boot

Best Seller

69 Lectures 5 hours

Senol Atac

Video

JWT Role Based Authorization With Spring Boot And Angular 8

53 Lectures 3.5 hours

Senol Atac

Advertisements