如何在我的机器中同时保持 ionic 3 和 ionic 4 版本

How to keep both the ionic 3 and ionic 4 version together in my machine

我在许多应用程序中使用 ionic 3 版本并且运行良好。现在对于我的新项目,我想在 ionic 4 中进行开发,但不想卸载 ionic 3。因此,当我 运行 下面的命令在本地安装 ionic 4 时,它会引发错误。

命令:

npm install ionic@rc cordova

错误:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for ionic@rc
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/username/.npm/_logs/2019-03-04T09_28_35_725Z-debug.log

如何解决这个问题?

此错误表明不存在 ionic 的现有 rc 版本。

试试这个。

$ npm install -g ionic

您不需要有不同的版本。您只需安装全局 CLI。 CLI 适用于所有版本的框架。

例如 https://github.com/ionic-team/starters

运行

ionic start myApp tabs --type ionic1  // for ionic 1    
ionic start myApp tabs --type ionic-angular // for ionic 2/3    
ionic start myApp tabs --type angular  // for ionic 4+