当我运行ng g foo
或ng g library foo
时,我得到
发生未处理的异常:;路径";参数的类型必须为字符串。收到未定义的
我的日志有,
[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)
版本。
Angular CLI: 12.1.1
Node: 14.17.3
Angular: 11.2.14
对我来说,这是因为我的angular.json
中有一个特定的不相关项目缺乏
"projects": {
"demo-app": {
"projectType": "application"
},
}
这可以通过删除demo-app
的条目或添加root
条目来解决
"projects": {
"demo-app": {
"projectType": "application"
"root": "projects/demo-app"
},
}
我已经打开问题#2310来跟踪这个