English 中文(简体)
Angular CLI - ng update
  • 时间:2024-12-22

Angular CLI - ng update Command


Previous Page Next Page  

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 apppcation 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

Apases: -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_cp/angular_cp_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!
Advertisements