Angular构建获得调试失败(在typeToString处)

时间:2017-12-21 19:26:45

标签: javascript angular ionic-framework

运行ionic cordova run ios --prod命令后,我收到以下错误。我正在使用离子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)

1 个答案:

答案 0 :(得分:2)

Latish回答,但这可能是因为双重声明相同变量在某个组件中声明不好:

export class MyComponent implements OnInit {

  centres : Array<any> = [];
  groups: Array<any> = [];
  headerList = [];
  actions= [];
  headerList :  [];  // <-- This is the culprit
}

注意带冒号的第二个headerList声明而不是equals。我看到即使是相当现代的IDE也没有报告这个问题。删除第二个声明会导致错误。

另外需要注意的是,一旦出现第一个错误,编译器将无法在监视模式下正确重启。您应该按CTRL-C然后重新启动它。

这个问题在2.4.2中为我提供。

相关问题