-
Notifications
You must be signed in to change notification settings - Fork 12k
ng g component <ComponentName> Failed with error "Project "undefined" does not exist." #23848
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
Comments
The root problem here is that a project cannot be determined. You can either change the current working directory using (cd) or provide the name of the project using the We should update the error message to be more actionable. |
This error occurs even when i executed |
Can you please share you |
While this option is always required it was not marked as such Closes angular#23848
@alan-agius4 You can see my angular.json below angular.json{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"blog-admin": {
"projectType": "application",
"root": "",
"sourceRoot": "src",
"architect": {...},
},
"blog-admin-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "blog-admin:serve"
},
"configurations": {
"ci": {
"protractorConfig": "./protractor.ci.conf.js"
}
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["e2e/**/*.ts"]
}
}
}
}
},
"schematics": {
"@schematics/angular:component": {
"prefix": "cnb",
"style": "less"
},
"@schematics/angular:directive": {
"prefix": "cnb"
}
}
}
|
The problem here is that your projects are misconfigured in the "blog-admin": {
"projectType": "application",
"root": "",
"sourceRoot": "src",
},
"blog-admin-e2e": {
"root": "",
"sourceRoot": "", |
After I changed |
While this option is always required it was not marked as such Closes #23848
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
generate
Is this a regression?
The previous version in which this bug was not present was
No response
Description
After updated to angular14, the
defaultProject
property in angular.json was removed after runng update
, however, when itry to create an component with
ng g component
command, it failed with "Project "undefined" does not exist." error, if i adddefaultProject
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
ng g component <componentName>
Exception or Error
No response
Your Environment
The text was updated successfully, but these errors were encountered: