angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Cannot use the new command inside an Angular CLI project

Open zhouzhou-96 opened this issue 9 years ago • 12 comments

I want to use Angular CLI to start a project.But I can't use the new command inside an Angular CLI project. 2017-07-27 14 56 56 How can I solve it?Thank you.

zhouzhou-96 avatar Jul 27 '17 07:07 zhouzhou-96

There is probably a angular-cli.json somewhere in your path tree. The ng command looks for an angular-cli.json file recursively until it hits the root.

Check if there's an angular-cli.json in your home dir.

grizzm0 avatar Jul 27 '17 07:07 grizzm0

Closing as answered by @grizzm0 👍

filipesilva avatar Jul 31 '17 10:07 filipesilva

Hi I have the same issue and can you elaborate on how to check whether there's angular-cli.json in my home dir or not, I don't seem to find it. Thanks

pavankumar58 avatar Sep 19 '17 04:09 pavankumar58

If you are using Windows, you should delete the package.json, package-lock.json files in the C:/Users/{username} folder.

hlthi avatar Dec 14 '17 01:12 hlthi

Thx o/

gutocenci avatar Dec 31 '17 12:12 gutocenci

I had the similar problem and nothing was working out but then when I ran cmd as administrator it worked for me. First run the Command Prompt as administrator ans then create the new project and if it still doesn't create the project run the code rm -r -f // and then run ng new and then run ng serve and it should work. If nothing works just uninstall node and every other file related to it and run the previous code again it will work.

ASrima avatar Jan 03 '18 05:01 ASrima

I'm using MacOS and I had this problem today... The way I fixed it was:

1 - I had no idea why, but there was a node_modules and a package.json on my home folder... I removed them; 2 - I also removed a node_modules and package.json from my current project folder 3 - Then, ng new project-name worked :)

I hope it helps somebody else...

p.s.: Please, angular@cli people, take a look at this weird thing going on... I don't know why angular@cli is creating such files in the home o.O

andreobueno avatar Jan 31 '18 08:01 andreobueno

Same solution , ensuer no node_modules / package.json in the directory

CRanaboldo avatar Feb 25 '18 15:02 CRanaboldo

@zhouzhou-96 Execute o prompt de comando como administrador e, em seguida, crie o novo projeto e ele deve funcionar e quando você usa o IDE, abra como administrador para editar e salvar o projeto. Use também a versão mais recente do nó, se nada funcionar, desinstale e reinstale a versão mais recente e, em seguida, siga o mesmo processo de execução CMD e IDE como administrador.

Crystyanno avatar Mar 15 '18 12:03 Crystyanno

while execute this command "ng new your-app-name" check your directory whether it has node_modules and package.json.... if it has in the directory don't execute that command... change the directory which no node_modules and package.json and try that command it will work/////////

eragon11 avatar Apr 01 '18 12:04 eragon11

Same issue. It was solved by deleting package.json and package-lock.json files in user folder on mac.

sannminwin avatar Apr 27 '18 17:04 sannminwin

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.