{ "id": "guide/npm-packages", "title": "Workspace npm dependencies", "contents": "\n\n\n
The Angular Framework, Angular CLI, and components used by Angular applications are packaged as npm packages and distributed via the npm registry.
\nYou can download and install these npm packages by using the npm CLI client, which is installed with and runs as a Node.js® application. By default, the Angular CLI uses the npm client.
\nAlternatively, you can use the yarn client for downloading and installing npm packages.
\nSee Local Environment Setup for information about the required versions and installation of Node.js
and npm
.
If you already have projects running on your machine that use other versions of Node.js and npm, consider using nvm to manage the multiple versions of Node.js and npm.
\npackage.json
linkBoth npm
and yarn
install the packages that are identified in a package.json
file.
The CLI command ng new
creates a package.json
file when it creates the new workspace.\nThis package.json
is used by all projects in the workspace, including the initial app project that is created by the CLI when it creates the workspace.
Initially, this package.json
includes a starter set of packages, some of which are required by Angular and others that support common application scenarios.\nYou add packages to package.json
as your application evolves.\nYou may even remove some.
The package.json
is organized into two groups of packages:
Library developers: By default, the CLI command ng generate library
creates a package.json
for the new library. That package.json
is used when publishing the library to npm.\nFor more information, see the CLI wiki page Library Support.
The packages listed in the dependencies
section of package.json
are essential to running applications.
The dependencies
section of package.json
contains:
Angular packages: Angular core and optional modules; their package names begin @angular/
.
Support packages: 3rd party libraries that must be present for Angular apps to run.
\nPolyfill packages: Polyfills plug gaps in a browser's JavaScript implementation.
\nTo add a new dependency, use the ng add
command.
The following Angular packages are included as dependencies in the default package.json
file for a new Angular workspace.\nFor a complete list of Angular packages, see the API reference.
Package name | \nDescription | \n
---|---|
@angular/animations | \nAngular's animations library makes it easy to define and apply animation effects such as page and list transitions. For more information, see the Animations guide. | \n
@angular/common | \nThe commonly-needed services, pipes, and directives provided by the Angular team. The HttpClientModule is also here, in the @angular/common/http subfolder. For more information, see the HttpClient guide. | \n
@angular/compiler | \nAngular's template compiler. It understands templates and can convert them to code that makes the application run and render. Typically you don’t interact with the compiler directly; rather, you use it indirectly via platform-browser-dynamic when JIT compiling in the browser. For more information, see the Ahead-of-time Compilation guide. | \n
@angular/core | \nCritical runtime parts of the framework that are needed by every application. Includes all metadata decorators, Component , Directive , dependency injection, and the component lifecycle hooks. | \n
@angular/forms | \nSupport for both template-driven and reactive forms. For information about choosing the best forms approach for your app, see Introduction to forms. | \n
@angular/ platform‑browser | \nEverything DOM and browser related, especially the pieces that help render into the DOM. This package also includes the bootstrapModuleFactory() method for bootstrapping applications for production builds that pre-compile with AOT. | \n
@angular/ platform‑browser‑dynamic | \nIncludes providers and methods to compile and run the app on the client using the JIT compiler. | \n
@angular/router | \nThe router module navigates among your app pages when the browser URL changes. For more information, see Routing and Navigation. | \n
The following support packages are included as dependencies in the default package.json
file for a new Angular workspace.
Package name | \nDescription | \n
---|---|
rxjs | \nMany Angular APIs return observables. RxJS is an implementation of the proposed Observables specification currently before the TC39 committee, which determines standards for the JavaScript language. | \n
zone.js | \nAngular relies on zone.js to run Angular's change detection processes when native JavaScript operations raise events. Zone.js is an implementation of a specification currently before the TC39 committee that determines standards for the JavaScript language. | \n
Many browsers lack native support for some features in the latest HTML standards,\nfeatures that Angular requires.\nPolyfills can emulate the missing features.\nThe Browser Support guide explains which browsers need polyfills and\nhow you can add them.
\n\nThe packages listed in the devDependencies
section of package.json
help you develop the application on your local machine. You don't deploy them with the production application.
To add a new devDependency
, use either one of the following commands:
The following devDependencies
are provided in the default package.json
file for a new Angular workspace.
Package name | \nDescription | \n
---|---|
@angular‑devkit/ build‑angular | \nThe Angular build tools. | \n
@angular/cli | \nThe Angular CLI tools. | \n
@angular/ compiler‑cli | \nThe Angular compiler, which is invoked by the Angular CLI's ng build and ng serve commands. | \n
@types/... | \nTypeScript definition files for 3rd party libraries such as Jasmine and Node.js. | \n
codelyzer | \nA linter for Angular apps whose rules conform to the Angular style guide. | \n
jasmine/... | \nPackages to support the Jasmine test library. | \n
karma/... | \nPackages to support the karma test runner. | \n
protractor | \nAn end-to-end (e2e) framework for Angular apps. Built on top of WebDriverJS. | \n
ts-node | \nTypeScript execution environment and REPL for Node.js. | \n
tslint | \nA static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. | \n
typescript | \nThe TypeScript language server, including the tsc TypeScript compiler. | \n
For information about how the Angular CLI handles packages see the following guides:
\nBuilding and serving describes how packages come together to create a development build.
\nDeployment describes how packages come together to create a production build.
\n