Issue
When I run ng g foo
or ng g library foo
, I get
An unhandled exception occurred: The "path" argument must be of type string. Received undefined
My log has,
[error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at Object.resolve (path.js:1074:7)
at isInside (/home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/utilities/config.js:211:35)
at /home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/utilities/config.js:221:28
at Array.filter (<anonymous>)
at findProjectByPath (/home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/utilities/config.js:221:10)
at Object.getProjectByCwd (/home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/utilities/config.js:250:21)
at GenerateCommand.getDefaultSchematicCollection (/home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/models/schematic-command.js:304:38)
at async GenerateCommand.parseSchematicInfo (/home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/commands/generate-impl.js:70:30)
at async GenerateCommand.initialize (/home/ecarroll/cp/js/cjt3/node_modules/@angular/cli/commands/generate-impl.js:17:49)
Versions.
Angular CLI: 12.1.1
Node: 14.17.3
Angular: 11.2.14
Solution
For me this was because I had a specific unrelated project in my angular.json
that lacked
"projects": {
"demo-app": {
"projectType": "application"
},
}
This could be fixed by either deleting the entry for demo-app
or adding the root
entry,
"projects": {
"demo-app": {
"projectType": "application"
"root": "projects/demo-app"
},
}
I've opened up issue #21310 to track this
Answered By - Evan Carroll
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.