October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Managing npm Dependencies in Angular: Add, Update, and Resolve Packages

Angular dependencies are declared in package.json and resolved versions are recorded in package-lock.json. Learn when to use ng add, ng update, and the Angular Update Guide.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular dependencies are npm packages declared in a workspace’s package.json; package-lock.json records the installed package versions. Use Angular CLI commands such as ng add and ng update when they apply, and consult the Angular Update Guide before major-version migrations.

How Angular projects use npm dependencies

Angular, its CLI, and application libraries are distributed as npm packages. A generated workspace commonly includes packages such as @angular/core, @angular/common, @angular/router, @angular/cli, rxjs, and typescript. This is a typical starting set, not a fixed list required by every Angular project. See Angular’s workspace npm dependencies documentation.

As an Amazon Associate I earn from qualifying purchases.

A workspace can contain one or more projects. Its root package.json configures packages available to projects in that workspace; a generated library can also have its own manifest. The two key files serve different purposes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • package.json declares the project’s dependencies and the version ranges it allows.
  • package-lock.json records version information for packages installed under node_modules, helping reproduce the resolved installation.

The lockfile does not replace the manifest: one declares the dependencies, while the other records the resolved package versions. Angular explains the workspace files in its file-structure documentation.

How to add an Angular library

Use ng add when the library supports it

For many Angular libraries, start with ng add. It installs the published package and can run the library’s schematic to make setup changes, such as adding configuration or scaffolding. For example, the general form is:

ng add <library>

Use the library’s own installation instructions and check which Angular versions it supports. Compatibility and setup requirements vary by package; the Angular CLI cannot guarantee that every third-party library supports your project’s version.

Choose a package manager consistently

Angular workspaces can be created with npm, yarn, pnpm, or bun. Use the package manager and lockfile already adopted by the project rather than casually switching tools; package-manager options are documented in the Angular CLI’s workspace creation reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to update Angular and other dependencies

Update Angular core and CLI

Use Angular CLI’s ng update to check and apply supported Angular package updates. The documented basic command for the core framework and CLI is:

ng update @angular/cli @angular/core

Angular recommends using the latest patch release in the major version line you have chosen. For a major-to-major migration, specify the target major version for both packages. For example, replace <target-major> with the intended major number:

ng update @angular/cli@<target-major> @angular/core@<target-major>

Before a major update, select your current and target versions in the interactive Angular Update Guide. It provides migration steps tailored to that version path. The CLI also documents the ng update command and its options.

Update third-party packages selectively

Use ng update to check for update guidance for Angular libraries that support it. Follow the library maintainer’s compatibility and migration instructions for other packages. Avoid updating every dependency indiscriminately: Angular’s guidance recommends updating specific dependencies first, and peer-dependency mismatches can prevent an otherwise straightforward update. Review the changes, run the project’s tests, and address migration steps before proceeding with additional packages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changes between patch, minor, and major releases?

Angular’s release policy distinguishes updates that can be applied without application changes from those that require code or configuration work. The distinction helps set expectations, but it does not remove the need to check your project and its third-party packages.

Release type Angular’s stated approach What to expect
Patch Bug-fix releases are characterized as low risk. Usually the least disruptive update type, though you should still validate your application.
Minor Dependency updates are generally optional when they do not require application changes. You can choose whether to take optional dependency updates; check package compatibility and release details.
Major Dependency updates that require application changes are introduced in major releases. Migration work may include scripts, refactoring, testing, and adapting to changed APIs.

Angular core and CLI versions have been aligned since Angular 7. For current policy details, see Angular’s versioning and releases documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to approach dependency version conflicts

A peer-dependency mismatch can block an update because packages may expect compatible versions of Angular or of one another. Do not treat a forced install as the default fix: it can bypass the compatibility warning without resolving the underlying mismatch.

  1. Identify which package reports the mismatch and check its documented Angular compatibility and migration steps.
  2. Use ng update for Angular packages and supported Angular libraries; update specific dependencies rather than changing everything at once.
  3. Use the Angular Update Guide for the current-to-target framework migration, then follow any library-specific instructions.
  4. After each focused update, review the changes and run the application’s tests before moving on to more dependencies.

Angular’s update documentation explains supported update workflows and notes that peer-dependency mismatches can affect the process: Update Guide and ng update.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publishing an Angular library

If you maintain a library, declare Angular packages that it consumes as peerDependencies. Putting @angular/core in ordinary dependencies can cause the library and consuming application to resolve separate Angular module instances, which can break the application. Angular also recommends publishing libraries compiled with partial-Ivy output; full-Ivy instructions are not public API. See Angular’s library creation guidance.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.