ng generate:发生未处理的异常:"path" 参数必须是字符串类型。收到未定义
ng generate: An unhandled exception occurred: The "path" argument must be of type string. Received undefined
当我运行ng g foo
或ng g library foo
时,我得到
An unhandled exception occurred: The "path" argument must be of type string. Received undefined
我的日志有,
[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"
},
}
我已经打开了 issue #21310 to track this
当我运行ng g foo
或ng g library foo
时,我得到
An unhandled exception occurred: The "path" argument must be of type string. Received undefined
我的日志有,
[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"
},
}
我已经打开了 issue #21310 to track this