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?

2
  • The error means what it says. Are you certain that there's no angular.json in current or parent directory? Commented Nov 17, 2018 at 17:58
  • 1
    after this command ng new project_name did you cd project_name before starting npm?? Commented Nov 17, 2018 at 18:50

6 Answers 6

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.

Sign up to request clarification or add additional context in comments.

Comments

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:

2 Comments

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?
What does ng -v say? Does ng new foo && cd foo && npm i && npm start work?
4

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

Comments

1

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

Comments

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.

Comments

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",

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.