You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ionic 3执行ionic cordova build android --prod时CLI冻结求助

Ionic 3 Build Stuck on Webpack Step After Copy (CLI Freezes)

Hey there, sorry to hear your Ionic 3 build's getting stuck on the webpack step right after copy—this is super frustrating, but let's walk through some tried-and-true fixes to get you back on track:

  • Wipe All Build Caches & Dependencies
    Old cached files or corrupted dependencies are often the culprit here. Run these commands to start fresh:

    rm -rf node_modules
    rm package-lock.json
    npm cache clean --force
    npm install
    

    Don't forget to clear Ionic's native build cache too:

    ionic cordova clean android
    
  • Check for Troublesome Plugins
    If you added any new Cordova or npm plugins since your last successful build, they might be causing webpack to hang. Try removing recent plugins one by one and re-running the build to spot the problem child. Plugins that handle assets or have complex pre-build scripts are usually the suspects.

  • Bump Node.js Memory Limits
    Webpack can hit memory caps during production builds, especially for larger apps. Try running the build with increased memory allocation:

    node --max-old-space-size=4096 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build --prod
    

    Then follow up with the Cordova build:

    ionic cordova build android
    
  • Update Ionic App Scripts
    Your project is using ionic-app-scripts 3.1.9, which is a bit outdated. Ionic 3's final stable app-scripts version is 3.2.4—update it with:

    npm install @ionic/app-scripts@3.2.4 --save-dev
    

    This often resolves build pipeline bugs from older versions.

  • Inspect Custom Webpack Configs
    If you modified your webpack config (either via a standalone webpack.config.js or ionic.config.json), double-check for misconfigured loaders, infinite loops, or broken plugin setups. Try reverting to the default config temporarily to see if the build unfreezes.

  • Run Build in Verbose Mode
    To pinpoint exactly where webpack is stuck, enable verbose logging:

    npm run ionic:build --prod -- --verbose
    

    This will print detailed logs of each module webpack is processing, making it easy to spot the problematic file or dependency.

内容的提问来源于stack exchange,提问作者sketchthat

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:33:35