ng 生成:发生未经处理的异常:"path"参数必须是字符串类型。已接收未定义



当我运行ng g foong 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来跟踪这个

相关内容

  • 没有找到相关文章

最新更新