运行 ionic cordova run ios --prod
后出现以下错误命令。我正在使用 ionic 3 并且想在 ios 模拟器上运行我的。
Error: Debug Failure.
at typeToString (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:28777:22)
at checkVariableLikeDeclaration (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:44893:199)
at checkParameter (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:43030:13)
at Object.forEach (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:1506:30)
at checkSignatureDeclaration (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:43171:16)
at checkConstructorDeclaration (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:43398:13)
at checkSourceElement (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:46712:28)
at Object.forEach (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:1506:30)
at checkClassDeclaration (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:45765:16)
at checkSourceElement (/Users/xafar/Documents/Projects/SeekThisPlace/mobile/node_modules/typescript/lib/typescript.js:46779:28)
最佳答案
Latish 答案,但这可能是由于双重声明相同变量和在组件中错误地声明它而导致的:
export class MyComponent implements OnInit {
centres : Array<any> = [];
groups: Array<any> = [];
headerList = [];
actions= [];
headerList : []; // <-- This is the culprit
}
请注意第二个 headerList 声明是用冒号而不是等号。我发现即使是相当现代的 IDE 也不会报告这个问题。删除第二个声明可以消除错误。
还要注意,一旦出现第一个错误,编译器将无法在监视模式下正确重新启动。您应该按住 CTRL-C,然后再次启动它。
这个问题在 2.4.2 中就出现过。
关于javascript - Angular 构建出现调试失败(在 typeToString 处),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47931548/