为生产构建 ionic 3 应用程序失败,我不明白为啥?

Posted

技术标签:

【中文标题】为生产构建 ionic 3 应用程序失败,我不明白为啥?【英文标题】:build ionic 3 app for production failed and i'm not understand why?为生产构建 ionic 3 应用程序失败,我不明白为什么? 【发布时间】:2020-06-09 19:28:12 【问题描述】:

当我使用此命令为生产构建我的 ionic v3 应用程序时:

ionic cordova build android --prod --release

它没有给出这个错误

[02:27:35]  ngc started ... 
[02:27:40]  ionic-app-script task: "build" 
[02:27:40]  RangeError: Maximum call stack size exceeded 
RangeError: Maximum call stack size exceeded
    at StaticReflector.annotations (/home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:30412:14)
    at NgModuleResolver.resolve (/home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:20105:70)
    at CompileMetadataResolver.getNgModuleMetadata (/home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:15101:60)
    at CompileMetadataResolver.getNgModuleSummary (/home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:15042:52)
    at /home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:15149:68
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.getNgModuleMetadata (/home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:15144:49)
    at CompileMetadataResolver.getNgModuleSummary (/home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:15042:52)
    at /home/nazeeh/Desktop/ionic Projects/Aromix/node_modules/@angular/compiler/bundles/compiler.umd.js:15149:68
    at Array.forEach (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ionicEcommerce@0.0.1 ionic:build: `ionic-app-scripts  build "--prod" "--target" "cordova" "--platform" "android"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ionicEcommerce@0.0.1 ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nazeeh/.npm/_logs/2020-02-26T00_27_40_834Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm run ionic:build -- --prod --target cordova --platform android exited
        with exit code 1.

        Re-running this command with the --verbose flag may provide more
        information.

【问题讨论】:

【参考方案1】:

当您的代码中有一些无限循环时,实际上会发生超出最大调用堆栈大小的错误。验证您的模块的负载或您的方法的调用

【讨论】:

当我调试应用程序时没有发现任何错误,所有功能都运行良好。不会发生无限循环。

以上是关于为生产构建 ionic 3 应用程序失败,我不明白为啥?的主要内容,如果未能解决你的问题,请参考以下文章

sh 为生产Ionic 3构建应用程序

Ionic 3 - 无法在 iOS 上安装生产应用程序

Ionic app,错误:..main.ts模块构建失败:错误:ENOENT

Ionic 构建/运行 ios 失败,错误代码为 65。如何修复?

在 IONIC 项目中升级到电容器 3 后,Android Studio 构建失败

如何在生产模式下构建 Ionic 应用程序,Ionic 构建的行为不同