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

Ionic v4项目创建咨询:已升级CLI后依赖版本疑问

Fixing Angular 5 Dependencies in Ionic v4 RC.5 Project

Hey there! I see you've got Ionic CLI v4.0.0-rc.5 installed, but your new blank project is still pulling in Angular 5 dependencies—let's sort this out right away.

The main issue here is almost certainly cached old templates from earlier Ionic v4 beta/RC builds that were tied to Angular 5. Here's how to fix it step by step:

  • Force a clean template fetch when creating the project
    Instead of the standard ionic start command, add the --clean flag to make the CLI bypass cached templates and pull the latest ones matching your CLI version:

    ionic start newproj blank --clean
    
  • Manually specify the matching template version (if clean mode fails)
    Explicitly link to the @ionic/angular-templates package that aligns with your CLI version to guarantee compatibility:

    ionic start newproj blank --type=angular --template=@ionic/angular-templates@4.0.0-rc.5
    
  • Reset your global Ionic installation (for persistent cache issues)
    If the above steps don't work, wipe the global setup and cache entirely:

    1. Uninstall the global Ionic CLI:
      npm uninstall -g ionic
      
    2. Clear your npm cache to remove leftover cached packages:
      npm cache clean --force
      
    3. Reinstall the RC.5 version:
      npm install -g ionic@4.0.0-rc.5
      
    4. Create your project again using the --clean flag from the first step.

After following these steps, check your project's package.json—you should see @ionic/angular at version 4.0.0-rc.5 and Angular dependencies (like @angular/core) at version 6.x (e.g., 6.1.10), which is the correct pairing for Ionic v4 RC.5.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 08:05:20