Angular-cli: "You cannot use the new command inside an angular-cli project", when the current directory isn't an angular cli generated project

Created on 16 Sep 2016  路  7Comments  路  Source: angular/angular-cli

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    MacOSX Yosimite v10.10.5
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    angular-cli: 1.0.0-beta.14
    node: 4.5.0
    os: darwin x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    I try to use ng new in any directory on my machine
  4. The log given by the failure. Normally this include a stack trace and some
    more information.
    "You cannot use the new command inside an angular-cli project."
  5. Mention any other details that might be useful.
    I am not inside a project created by the cli. In fact I cant use the command anywhere, in any directory.

Thanks! We'll be in touch soon.

Most helpful comment

I went to my home directory and in my package.json removed all references to angular-cli. I was then able to use ng new. MAC-OSX Sierra

All 7 comments

@jgo4th - the ng new command creates a new project which you cannot do within an existing project. You can, however, use the other commands, e.g., ng generate anywhere within an existing project.

The issue tracker is for bugs and feature requests as noted in CONTRIBUTING.md. For better support, consider creating a question on StackOverflow with all the details.

No as in, I cannot use the command ng new in any directory on my device. I am not in any existing projects. What is the cli looking at to determine if its an existing project? Because It believes my Downloads, Documents, and other generic folders, not created by angular-cli, are angular-cli projects. Definitely a blocking issue to even use the CLI.

@jgo4th -- please use StackOverflow for support questions.

@jgo4th your issue might be related with these two:
https://github.com/angular/angular-cli/issues/1079
https://github.com/angular/angular-cli/issues/1045

Do you maybe have a package.json or angular-cli.json somewhere in your home folder? There's probably something up your directory tree that makes the CLI think that it's inside of a project already. The CLI only looks up directories to do this.

I went to my home directory and in my package.json removed all references to angular-cli. I was then able to use ng new. MAC-OSX Sierra

@filipesilva @juliemr Thanks for your answers. I didn't find package.json in my home folder, but in the parent folder. Hopefully, this would help someone else too. :)

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sysmat picture sysmat  路  3Comments

jbeckton picture jbeckton  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

daBishMan picture daBishMan  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments