10

I have this error using ng new project_name:

An invalid configuration file was found ['angular.json']. Please delete the file before running the command.

I am getting this error I don't know how to get the solution.

I uninstalled @angular/cli and installed again

npm clean cache doesnt work too (I dont know if it is problem of my npm version

npm version is 6.4.1    
node version is 8.11.1

what do i need to solve the problem?

Dave
  • 7,028
  • 11
  • 35
  • 58

6 Answers6

24

If you are using the terminal of IntelliJ IDEA while there is a angular project already imported in the IDEA, it is the problem of the IDEA.So, open the command promt of your windows and create the project.

I did this and I was able to create the project.

Aashman Thing
  • 302
  • 2
  • 6
4

The problem seems to be the _ in project_name resulting in the following error:

Schematic input does not validate against the Schema: {"name":"project_name","version":"6.0.1","newProjectRoot":"projects","skipInstall":false,"linkCli":false,"skipGit":false,"commit":null}
Errors:

  Data path ".name" should match format "html-selector".

Replace _ e.g. with -.

Further readings:

pzaenger
  • 11,381
  • 3
  • 45
  • 46
  • ng new cvfrontend: I had the same problem, anyway I could created in the past names with underscot character. What do you need to show you my configuration? – Dave Nov 18 '18 at 18:43
  • What does `ng -v` say? Does `ng new foo && cd foo && npm i && npm start` work? – pzaenger Nov 18 '18 at 18:57
4

Setting the working directory in IntelliJ's Karma task, to the Angular project's main directory, also fixes the problem.

Stefan
  • 12,108
  • 5
  • 47
  • 66
1

I deleted the file in c:\users\XXX\.angular.json and it was running ok.

Dave
  • 7,028
  • 11
  • 35
  • 58
0

Run following if file is hidden. Open Terminal, run mv /Users/shivammishra/.angular.json /Users/shivammishra/angular.json.txt. mv command will move the file to new location (angular.json.txt) and you can then delete.

JustSomeGuy
  • 3,677
  • 1
  • 23
  • 31
0

Angular.js & Wrong Directions.

First of all, open a file called angular.js in the root folder.

And check if you add some wrong Directory. like the style or something like that. as example.

Suppose you add the bootstrap dependency and you want to add it to your project you will go to the angular.js and add it in the style configuration. so you will add it as the below:

 "styles": [
              "./node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles.css"
            ],

Check if you add double dot .. not one dot in the path like the below:

"../node_modules/bootstrap/dist/css/bootstrap.min.css",

Or you maybe add it in the following format:

"/node_modules/bootstrap/dist/css/bootstrap.min.css",

or

"node_modules/bootstrap/dist/css/bootstrap.min.css",

The correct format is :

 "./node_modules/bootstrap/dist/css/bootstrap.min.css",
Abd Abughazaleh
  • 4,615
  • 3
  • 44
  • 53