Ionic 创建离子框架4项目

wj8zmpe1  于 2022-12-08  发布在  Ionic
关注(0)|答案(2)|浏览(195)

I have globally installed the latest version of Ionic CLI 4 (4.12.0) by running npm install -g ionic@4.12.0 , after that, I created a new Ionic project using ionic start , I opened the project and checked my package.json file :

"dependencies": {
    "@angular/common": "~9.1.6",
    "@angular/core": "~9.1.6",
    "@angular/forms": "~9.1.6",
    "@angular/platform-browser": "~9.1.6",
    "@angular/platform-browser-dynamic": "~9.1.6",
    "@angular/router": "~9.1.6",
    "@ionic-native/core": "^5.0.7",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^5.0.0",
    "rxjs": "~6.5.1",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  }

And as you can see, Ionic version installed is "5". Any suggestions to create Ionic 4 project instead of Ionic 5 project?
ionic --version : 4.12.0.
Thank you.

f0ofjuux

f0ofjuux1#

If you really want to use Ionic 4, you can install a specific version of any package by adding @[version] after the package name, so in your case for @ionic/angular , you need @ionic/angular@4.11.10 .
In your project root, run:

npm i @ionic/angular@4.11.10

(version 4.11.10 is the LTS)

yquaqz18

yquaqz182#

我使用ionic已经两年了,据我所知,v5和v4在语法或兼容性上没有区别,所以你可以使用v5,而不用担心任何事情。

相关问题