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
Commands | Description |
---|---|
npm install -g @angular/cli | Install the CLI using the npm package manager. |
ng build | Compiles and build an Angular app into an output directory. |
ng version | Get Angular CLI version |
ng e2e | Runs end-to-end tests using Protractor. |
ng generate | Generates ,modifies files based on a schematic. -component -class -directive -enum -guard -interceptor -interface -library -module -pipe -service -serviceWorker -webWorker -appShell -application |
ng test | Runs unit tests cases |
ng new | Creates and initializes a new Angular app |
ng run | compile and run based on builder configuration defined in project |
ng lint | Runs linting tool on the code |
ng update @angular/cli @angular/core | Update 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_modules | Delete 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
Error:
Angular 13
Resolution
Please see below article,
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.