ng-new
creates a new Angular workspace and generates an initial application
TLDR
Create a new Angular workspace
SYNOPSIS
ng new [name] [options]
DESCRIPTION
ng new creates a new Angular workspace and generates an initial application. It scaffolds the complete project structure including configuration files, source directories, and optionally installs npm dependencies.
The command sets up TypeScript configuration, Angular-specific settings in angular.json, and testing infrastructure with Karma and Jasmine. The generated workspace follows Angular best practices and conventions.
When run without the --defaults flag, the CLI prompts for routing preferences and stylesheet format. The --strict option enables additional TypeScript compiler checks, stricter bundle budgets, and lint rules for improved code quality.
PARAMETERS
NAME
Name for the new workspace and initial project.--routing
Generate a routing module for the initial project.--style STYLE
File extension for style files (css, scss, sass, less).--skip-git
Do not initialize a git repository.--skip-install
Do not install dependency packages.--skip-tests
Do not generate spec files for the initial project.--strict
Enable stricter type checking and bundle budgets.--defaults
Disable interactive prompts and use default values.--dry-run
Run through without making changes (preview mode).--prefix PREFIX
Prefix for generated selectors (default: app).--package-manager PM
Package manager to use (npm, yarn, pnpm, cnpm).--directory DIR
Directory to create the workspace in.--inline-style
Include styles inline in the component TS file.--inline-template
Include template inline in the component TS file.--view-encapsulation MODE
View encapsulation strategy (Emulated, None, ShadowDom).--ssr
Configure the application for Server-Side Rendering.--help
Display help information.
CAVEATS
Requires Node.js and Angular CLI installed globally (npm install -g @angular/cli). The workspace name must be a valid npm package name (lowercase, no spaces). Creating large workspaces with full dependency installation can take several minutes depending on network speed.
HISTORY
The ng new command has been part of Angular CLI since its initial release in 2016. It evolved alongside Angular, adding options for routing in Angular 4, strict mode in Angular 10, and SSR scaffolding in Angular 17. The command generates standalone components by default since Angular 17.
SEE ALSO
ng(1), ng-generate(1), ng-serve(1), ng-build(1)
