Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng7 can not generate new project #12215

Closed
wszgrcy opened this issue Sep 9, 2018 · 23 comments
Closed

ng7 can not generate new project #12215

wszgrcy opened this issue Sep 9, 2018 · 23 comments

Comments

@wszgrcy
Copy link

wszgrcy commented Sep 9, 2018

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

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Sep 9, 2018

Edit: duplicate of #12198

@alan-agius4 alan-agius4 marked this as a duplicate of #12215 Sep 9, 2018
@kevincaradant
Copy link

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 ;)

@sstone2423
Copy link

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

@mo-norant
Copy link

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

@tgoawa
Copy link

tgoawa commented Oct 24, 2018

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

@MarkyMarc35
Copy link

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

@JohnGrisham
Copy link

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.

@joe20123
Copy link

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

@demonguru18
Copy link

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

@vishnu106
Copy link

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.

@demonguru18
Copy link

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

@demonguru18
Copy link

demonguru18 commented Nov 1, 2018

Here are the Steps to Execute - doc File (Google Drive Link)
https://docs.google.com/document/d/1eXsBLjDavetyE-TnD2fnpisCkHWfRHTUVOjRIrgnEEM/edit?usp=sharing

@demonguru18
Copy link

demonguru18 commented Nov 1, 2018

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

idl99 added a commit to idl99/Library-Manager-Client that referenced this issue Nov 17, 2018
@MHX123
Copy link

MHX123 commented Dec 6, 2018

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

@WarrenWalker
Copy link

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.

@0rajat1
Copy link

0rajat1 commented Dec 12, 2018

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 ! :)

@nani554
Copy link

nani554 commented Jan 6, 2019

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.

@afifkraiem
Copy link

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

@tiwarinitin94
Copy link

@afifkraiem Thank you so much this worked for me.

@DocGreenRob
Copy link

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.

@somixyz
Copy link

somixyz commented Sep 17, 2019

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.

@demonguru18
Copy link

demonguru18 commented Sep 25, 2019

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests