Angular-cli: ng7 can not generate new project

Created on 9 Sep 2018  Â·  23Comments  Â·  Source: angular/angular-cli

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

Most helpful comment

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

All 23 comments

Hi

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

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

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

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

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

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

My issue was that my angular.json file was not in the root of my project. I moved it there and this fixed the error for me.

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

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

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

Can you please tell the steps to start the execution of this project.

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

Can you please tell the steps to start the execution of this project.
it should just work, when you press F5

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

I also encountered this problem. Is there any way to solve this problem?

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.

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.

i dont want to create new project but i need to create custom pipe by creating new .ts file in my already existing project. but at the time of creating it throws an error of- "The new command requires to be run outside of a project, but a project definition was found at "angular.json"". I am just a fresher , so please help me out . Thank you :)
And BTW , New Zealand is a great country ! :)

Recently i also faced this issue, nothing helped me atlast after thinking for a while i got to know that node-modules were not installed yet and installing the packages( npm i) solved the problem.

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

@afifkraiem Thank you so much this worked for me.

I'm having the same issue...

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.2
Node: 10.16.3
OS: win32 x64
Angular: 5.0.0
... common, compiler, core, forms, http, platform-browser
... platform-browser-dynamic

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.2 (cli-only)
@angular-devkit/build-optimizer   0.0.35
@angular-devkit/core              8.3.2 (cli-only)
@angular-devkit/schematics        8.3.2 (cli-only)
@angular/compiler-cli             8.2.0
@schematics/angular               8.3.2 (cli-only)
@schematics/update                0.803.2 (cli-only)
rxjs                              5.5.2
typescript                        2.8.3
webpack                           3.12.0

and when I run ng update @angular/cli --migrate-only --from=8.3.2 I get the following error:

Using package manager: 'npm'
Collecting installed dependencies...
Found 80 dependencies.
Package is not installed.

Me too, i got the same message... i'm beginner with angular, can someone more experienced could help, what could be a problem ?
I'm trying to start simple angular app, but the problem is actually with different CLI versions.
I tried with above mentioned code to migrate but didn't help. Tried also with ng update with some variations and npm install, but unsuccessfully.

http://prntscr.com/p7e4tv
on the left side is new version, on the right is older version.

Me too, i got the same message... i'm beginner with angular, can someone more experienced could help, what could be a problem ?
I'm trying to start simple angular app, but the problem is actually with different CLI versions.
I tried with above mentioned code to migrate but didn't help. Tried also with ng update with some variations and npm install, but unsuccessfully.

http://prntscr.com/p7e4tv
on the left side is new version, on the right is older version.

Update/Install latest version of npm - for mac or linux OS use sudo before command
Run npm -v to see which version you have, then npm install npm@latest -g to install the newest npm update. Run npm -v again if you want to make sure npm updated correctly.

Update angular to latest version Globally
sudo npm uninstall -g angular-cli // For Mac

npm uninstall -g angular-cli // For Windows Open Powershell on Administrator Mode

Then we need to clear the cache using the following command.
sudo npm cache verify

Now, install the Angular CLI using the following command.
sudo npm install -g @angular/cli@latest

If you have created an Angular project then go inside that folder and type the following command.
ng update @angular/core

You can update RxJS using the ng update command.
ng update rxjs

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