Missing .angular-cli.json file: Angular

2019-03-22 14:28发布

问题:

I've created Angular2 project using Angular-cli with the following command:

ng new project-name

but, I don't see .angular-cli.json file in my root folder of the project. The angular-cli version I'm using is 1.0.2. I've created multiple projects with cli in the past and have never encountered this problem. Is it because of the recent update? If yes, where can I find the json file? Or do I need to create it manually?

回答1:

Update: With Angular 6.0.0 the filename is changed from .angular-cli.json to angular.json.

.angular-cli.json is a hidden file since @angular/cli version 1.0.

The file got the prefix . with this version 1.0 , so it is hidden as @JB Nizet commented.

The change is described in the wiki of @angular/cli stories 1.0 update

The location of this file is unchanged.

When you create a new project with @angular/cli 1.0.2, the message

create .angular-cli.json

is displayed.



回答2:

angular-cli.json file has been renamed/replaced to angular.json from version 6.0.

mentioned here



回答3:

You will not see angular-cli.json instead you see this (with dot at the beginning) .angular-cli.json which is hidden file. On finder MAC OS go to the project root folder and do

command + shift + .

or on eclipse open the project in navigator

Window->Show View->Navigator

and

Eclipse -> Preferences -> Remote Systems -> Files: Check the "Show hidden files" Ok.

That way you could display or hide hidden file like (.git, .gitIgnore)



回答4:

I also somehow created an angular project that didn't have a .angular-cli/json file, but that otherwise appeared to build and test successfully.

Turns out that I created it by cloning the quickstart from GitHub using the instructions here: https://angular.io/guide/setup

If you install the full CLI, then it will generate projects that contain the missing file. Use npm install -g @angular/cli, per https://angular.io/guide/quickstart



回答5:

Click on ‘View Menu’ in the Project Explorer view and select ‘Filter(sts) / Customize View(eclipse)’. Uncheck the .*resources filter and you will now be able to see the .angular-cli.json in the project structure.



回答6:

angular-cli.json has now been changed to angular.json on angular 6