Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate .angular-cli.json file in Angular Cli?

I have installed Angular CLI package separately using npm:

npm install --save-dev @angular/cli@latest 

When I try to use commands cli I get an error:

Unable to find any apps in `.angular-cli.json`. 

How to generate .angular-cli.json for current project?

like image 408
OPV Avatar asked Jul 20 '17 07:07

OPV


People also ask

Where is Angular json CLI file?

The angular-cli. json should be located in the root folder of the project.

What is Angular CLI for Angular JSON file?

A file named angular. json at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults for build and development tools provided by the Angular CLI. Path values given in the configuration are relative to the root workspace folder.

What is used Angular CLI json?

Angular CLI uses JSON Schema to enforce the configuration schema. The Angular team created Schematics packages which are used by the CLI. We can configure the options of Schematics packages, as we please, for the root project and internal projects as well.


1 Answers

In Angular 6, .angular-cli.json has been replaced with angular.json

For Angular < 6:

Create a new file with name '.angular-cli.json' and add this file in your main directory.

{   "$schema": "./node_modules/@angular/cli/lib/config/schema.json",   "project": {     "name": "my-app"   },   "apps": [     {       "root": "src",       "outDir": "dist",       "assets": [         "assets",         "favicon.ico"       ],       "index": "index.html",       "main": "main.ts",       "polyfills": "polyfills.ts",       "test": "test.ts",       "tsconfig": "tsconfig.app.json",       "testTsconfig": "tsconfig.spec.json",       "prefix": "app",       "styles": [         "styles.css"       ],       "scripts": [],       "environmentSource": "environments/environment.ts",       "environments": {         "dev": "environments/environment.ts",         "prod": "environments/environment.prod.ts"       }     }   ],   "e2e": {     "protractor": {       "config": "./protractor.conf.js"     }   },   "lint": [     {       "project": "src/tsconfig.app.json",       "exclude": "**/node_modules/**"     },     {       "project": "src/tsconfig.spec.json",       "exclude": "**/node_modules/**"     },     {       "project": "e2e/tsconfig.e2e.json",       "exclude": "**/node_modules/**"     }   ],   "test": {     "karma": {       "config": "./karma.conf.js"     }   },   "defaults": {     "styleExt": "css",     "component": {}   } } 
like image 74
Manik Biradar Avatar answered Sep 16 '22 16:09

Manik Biradar