angular-cli: ng7 can not generate new project

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Repro steps

The log given by the failure

PS D:\test> ng test The test command requires to be run in an Angular project, but a project definition could not be found. PS D:\test> ng new ng7 The new command requires to be run outside of a project, but a project definition was found at “D:\test”. PS D:\test> ng v

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 7.0.0-beta.2 Node: 8.11.4 OS: win32 x64 Angular: …

Package Version

@angular-devkit/architect 0.9.0-beta.2 @angular-devkit/core 0.9.0-beta.2 @angular-devkit/schematics 0.9.0-beta.2 @schematics/angular 0.9.0-beta.2 @schematics/update 0.9.0-beta.2 rxjs 6.2.2 typescript 3.0.3

PS D:\test>

Desired functionality

why I run ng test it hint requires to be run in and ng new it hint requires to be run outside

Mention any other details that might be useful

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23

Commits related to this issue

Most upvoted comments

I came across the same error. The reason is that new angular cli update makes angular-cli.json redundant, and it is replaced with angular.json instead. My previous Angular Cli version is 1.7.4, so to make the change, I ran the following command, it will make the conversion for you:

ng update @angular/cli --migrate-only --from=1.7.4

Same issue here

The serve command requires to be run in an Angular project, but a project definition could not be found. error when ng serve is issued

ng update @angular/cli this command fixes the problem for me

Hi

Not a big deal but can you said: duplicate of his own question ? 😛

I think you made a mistake about the tag of the duplicate question, even if I didn’t find it for the moment 😉

Also experiencing this in a project I tried upgrading the Angular CLI to 7.0.2

image

So instead of naming the new project in a single command, I just waiting to be prompted.

$ ng new

as seen in the screenshot.

before you execute - Please do this Also Can you check you have - Updated version on Angular installed Globally ng version

image

If you don’t see this, to Update angular globally npm uninstall -g angular-cli npm cache clean or npm cache verify (if npm > 5) npm install -g @angular/cli@latest

Experiencing the same issue in a project I updated to Angular CLI 7

Wasn’t able to find a duplicate in the issue search… Can we reopen this as I’m having the same problem with all ng commands inside the angular project root folder

Here is an Starter Project I created for Asp.net Core 2.1, Angular 7.0.3 and Bootstrap 4.1.3 You can download this project and start. https://github.com/demonguru18/Angular7DotNetCore2.1BootStrap4