调试ionic3 app用于使用--prod标志构建它 [英] Debug ionic3 app for building it with --prod flag
问题描述
有一段时间,我没有使用 - prod
标志构建我的ionic3应用程序,它曾经工作正常,但我做了很多改动那。现在,当我运行离子cordova构建android --prod
时,我收到以下错误消息:
For a while, I didn't build my ionic3 app with --prod
flag, it used to work fine, but I've made quite a few changes since that. Now when I run ionic cordova build android --prod
I get this error message:
TypeError: Cannot read property 'length' of undefined
at Object.unescapeIdentifier (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:10550:26)
at getTextOfNode (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:68575:27)
at emitIdentifier (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66931:19)
at pipelineEmitUnspecified (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66594:28)
at pipelineEmitWithHint (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66566:50)
at pipelineEmitWithSourceMap (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66558:17)
at emitNodeWithComments (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:64200:17)
at pipelineEmitWithComments (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66547:17)
at pipelineEmitWithNotification (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66541:17)
at emit (/path/to/my/app/node_modules/@angular/compiler-cli/node_modules/typescript/lib/typescript.js:66528:13)
该应用程序构建并运行正常,无需 - prod
flag。
The app builds and run fine without --prod
flag.
我理解问题来自一个无法读取的未定义属性,因此打字稿拒绝编译代码。
I understand the problem comes from an undefined property that could not be read and therefore typescript refuse to compile the code.
我的问题是我不知道那个长度
属性在我的应用程序中的位置,因为有很多他们
有没有办法获得有关该属性在我的代码中的位置的更多信息,从typescript或ionic,以便我可以纠正此错误并能够使用构建应用程序 - prod
flag?
My problem is that I've no idea where that length
property is in my app, since there are plenty of them.
Is there a way to get more info about where that property is situated in my code, from typescript or ionic, so that I can correct this error and be able to build the app with --prod
flag?
推荐答案
你的一个 node_modules似乎有问题
项目或项目。所以删除 node_modules
文件夹,然后运行 npm i
It seems a problem with one of your node_modules
item or items. So delete node_modules
folder and then run npm i
这篇关于调试ionic3 app用于使用--prod标志构建它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!