由于我更新到Angular 5和@ ngtools / webpack(从1.8.0到1.9.0),我得到一个奇怪的错误,我无法找出它为什么错,我只是得到这个错误:
ERROR in : TypeError: Cannot read property 'getTsProgram' of undefined
at AngularCompilerPlugin._getTsProgram (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:187:62)
at getTypeChecker (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:511:43)
at ast_helpers_1.collectDeepNodes.filter (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/transformers/remove_decorators.js:14:60)
at Array.filter (<anonymous>:null:null)
at standardTransform (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/transformers/remove_decorators.js:14:14)
at transformer (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/transformers/make_transform.js:14:25)
at /home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:2479:86
at reduceLeft (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:2186:30)
at /home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:2479:42
at transformRoot (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:63992:82)
at Object.map (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:1693:29)
at Object.transformNodes (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:63980:30)
at Object.emitFiles (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:66715:28)
at emitWorker (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:70241:33)
at /home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:70203:66
at runWithCancellationToken (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:70295:24)
at Object.emit (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/typescript/lib/typescript.js:70203:20)
at defaultEmitCallback (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@angular/compiler-cli/src/transformers/program.js:33:20)
at AngularCompilerProgram.emit (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@angular/compiler-cli/src/transformers/program.js:241:30)
at AngularCompilerPlugin._emit (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:741:49)
at Promise.resolve.then.then.then (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:577:54)
at <anonymous>:null:null
at process._tickCallback (internal/process/next_tick.js:188:7)
是否有人发现此错误及其出现的原因?
答案 0 :(得分:1)
如果已经创建了一个hack,那么删除了Angular的@ ngtools / webpack删除装饰器任何版本(你可以升级到所有包),这是一个要点,代码在这里:
https://gist.github.com/p3x-robot/e12ed76acb7033638b4179149546bb73