I am trying to create a project (named ngadmin) via the angular cli but it throws errors on this command: ng new ngadmin
. The errors are:
In windows cd/User,Find the package.json,package-lock.json file and delete both the files.
Restart your command prompt and you are ready to go.And try to use this command
npm install --save-dev @angular/cli@latest
The first warning regarding graceful-fs is due to the fact that angular-cli uses older version of graceful-fs pkg, nothing to worry about that.
The error "You cannot use the new command inside an angular-cli project" signifies you are inside an angular cli project, get out of the angular cli project using cd ..
command and try running the command ng new ngadmin
it will work.
You must have used local "npm install @angular/cli" command to install angular locally in your project.
Uninstall local angular using "npm uninstall @angular/cli" install angular globally using "npm install -g @angular/cli"
and then try "ng new ngadmin"
Because "ng new projectName" will automatically install angular/cli locally as a dev-dependency
Delete the file package.json
in current directory where you are trying to create. Then try to install again.
there is a file package.json
Simply remove it and then Create project. it will work for sure