Skip to content

ng g component <ComponentName> Failed with error "Project "undefined" does not exist." #23848

Closed
@laggage

Description

@laggage

Command

generate

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

After updated to angular14, the defaultProjectproperty in angular.json was removed after run ng update, however, when i
try to create an component with ng g component command, it failed with "Project "undefined" does not exist." error, if i add defaultProject back to angular.json, the command will success, but a warning appeared in the console output "DEPRECATED: The 'defaultProject' workspace option has been deprecated. The project to use will be determined from the current working directory."

Minimal Reproduction

  • run ng g component <componentName>

Exception or Error

No response

Your Environment

✗ npm run ng -- version

> [email protected] ng
> ng version


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

Angular CLI: 14.2.1
Node: 16.13.1
Package Manager: npm 8.19.0 
OS: darwin x64

Angular: 14.2.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker


### Anything else relevant?

_No response_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions