Angular CLI Common Commands, Error and Resolution dictionary

Today in this article, we will cover below aspects,

Below are a few examples of the Angular CLI Common Commands, Error and Resolution dictionary,

Angular CLI Common Commands

CommandsDescription
npm install -g @angular/cli
Install the CLI using the npm package manager.
ng buildCompiles and build an Angular app into an output directory.
ng versionGet Angular CLI version
ng e2eRuns end-to-end tests using Protractor.
ng generateGenerates ,modifies files based on a schematic.


-component

-class
-directive
-enum
-guard
-interceptor
-interface
-library
-module
-pipe
-service
-serviceWorker
-webWorker

-appShell
-application
ng testRuns unit tests cases
ng newCreates and initializes a new Angular app
ng runcompile and run based on builder configuration defined in project
ng lintRuns linting tool on the code
ng update @angular/cli @angular/coreUpdate SPECIFIED individual Angular core package

ng update @angular/cli @angular/core
Set flag true and Allow updating the packages when the repository any contains modified or untracked files.
(might need option like – -force to execute the commands)
npm rm -rf node_modulesDelete node_module folder manually.(might need admin mode of CLI)
npm install @angular/cli@latest

Update the Angular CLI for a local workspace (Local). Run below command within your project workspace directory.
Recommended to run the commands with additional option like (- -save -dev) or (- -save – -only=dev)

Common errors and their resolution

Error:

An unhandled exception occurred: Cannot find module ‘@angular-devkit/build-angular/package.json’

Resolution

Please see here for resolution,

Error:

“Could not find module “@angular-devkit/build-angular”

Resolution

Resolution steps are captured in the below post,



Error:

“Cannot find module ‘@angular/compiler'”

Resolution

To fix the issue, please run the below command

npm install  angular/compiler


Error :

“Cannot find module ‘@angular/compiler-cli/ngcc”

Resolution

To fix the issue, please run the below command

npm install  angular/compiler-cli/ngcc 


Error:

“Can not find module ‘angular/compiler-cli’

Resolution

To fix the error please install the Angular CLI using the below command

npm install --save-dev @angular/cli@latest
Angular CLI Common Commands Error and Resolution dictionary


Error:

Angular 13

This version of cli is only compatible with angular versions ^12.0.0-next || >=12.0.0 <13.0.0, but angular version 11.2.14 was found instead

Resolution

Please see below article,

This version of cli is only compatible with angular versions ^12.0.0-next || >=12.0.0 <13.0.0, but angular version 11.2.14 was found instead.



Error:

“Repository is not clean. Please commit or stash any changes before updating”.

Resolution

Please see below article,



Error:

“‘ng’ is not recognized as an internal or external command, operable program or batch file”

Resolution

Please see here for resolution,

Resolved:’ng’ is not recognized as an internal or external command, operable program or batch file



Error:

“Could not find the implementation for builder @angular-devkit/build-angular:browser”

Resolution

Please see here for resolution,

Error:

Job name “..getProjectMetadata” does not exist.
Error: Job name “..getProjectMetadata” does not exist.
at Observable._subscribe

Resolution

Please see here for resolution,


Other useful references:





Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



Leave a Reply

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