Sitemap

Member-only story

Essential Angular CLI & npm Commands You Need to Know

--

Whether you’re starting fresh with Angular or maintaining a growing app, knowing the right commands can make your workflow smoother, faster, and less error-prone. Here’s a practical guide to the core Angular CLI and npm commands — with real-world context on when and why to use each.

Press enter or click to view image in full size
Photo by Joshua Aragon on Unsplash

Angular CLI Basic Commands: Build and Scale Your App Faster

1. Create a New Angular Application

# Create a new Angular project
ng new AppName

# If Angular not installed in you computer then use this command
npm install -g @angular/cli

# Serve the application locally
ng serve

# Automatically opens the app in your default browser
ng serve --open

# Serve with port options
ng serve --port 4200

# Build the application
ng build

# Run unit test cases
ng test

Why use it?
This creates a brand-new Angular app using the latest standalone component architecture, which reduces boilerplate and simplifies module management. Great for starting modern Angular projects cleanly.

2. Create a New Angular Application without Standalone Components:

ng new AppName --standalone=false

--

--