question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

> blog-admin@0.0.0 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_

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
laggagecommented, Sep 2, 2022

After I changed blog-admin-e2e.root to e2e, things worked, thanks for help

1reaction
alan-agius4commented, Sep 2, 2022

The problem here is that your projects are misconfigured in the angular.json. You have two projects in the same directory as the root is configured the same, as such the CLI cannot determine which project you intend to use.

     "blog-admin": {
            "projectType": "application",
            "root": "",
            "sourceRoot": "src",
    },
    "blog-admin-e2e": {
         "root": "",
         "sourceRoot": "",
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 14 not able to create components - Stack Overflow
0.2 but when I try to create new component, it throw following error. ng g c views/multi-select Project "undefined" does not exist. following...
Read more >
angular/angular-cli - Gitter
Hi I'm getting this error with webpack. TypeError: _firebase_appWEBPACK_IMPORTED_MODULE0default.a.registerVersion is not a function at auth.esm.js:372.
Read more >
Angular unit testing tutorial with examples - LogRocket Blog
This tutorial demonstrates how to build an Angular app and write a unit test, test an async operator, and automatically generate a unit ......
Read more >
ng generate - Angular
Do not import this component into the owning NgModule. boolean, false. --skip-selector. Specifies if the component should have a selector or not.
Read more >
Nastran Dmap Error Message List - Siemens PLM
USER FATAL MESSAGE 37 (XGPIDG). ERROR IN DMAP INSTRUCTION %1 INSTRUCTION NO.%2. WARNING ONLY - MAY NOT BE ENOUGH FILES AVAILABLE FOR. MODULE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found