Ionic cli 4 but ionic project is on 5 - ionic-framework

So I'm trying to create a new ionic 4 project, I installed the cli version 4
Cli version:
ionic -v command shows this line
CLI 4.12.0
but once I created the project and checked package.json of the project I found this line :
"#ionic/angular": "^5.0.0",
this is a little bit confusing, but this means that my project runs under ionic 5 ?
Thank you.

The cli has nothing to do with the #ionic/angular version. You can use the latest cli version, but install the #ionic/angular version you'd like, doing this:
npm i #ionic/angular#YOUR.VERSION.NUMBER
You can pick whatever version you'd like from here. Just go to Versions tab.
edit: you may want to do this before downgrading if you don't start a fresh install:
npm rm #ionic/angular --save

Related

How to install Ionic framework V5

I installed Ionic framework with npm.
npm install -g #ionic/cli
The installed version is 6.2.1, but in my work they using the version 5. How i can install the version 5 ?
6.2.1 is the version of the installed Ionic CLI. This is NOT the Ionic Framework version.
To check the Ionic Framework version of a project, open package.json and look for the version of #ionic/angular. It should be something like this: "#ionic/angular": "^5.0.5".
Also, the versions of the #ionic-native/* plugins would be 5 or greater.
To sum it up, if you are about to contribute to an Ionic 5 project, installing the latest version of the Ionic CLI is enough. When setting up the project on your machine, running npm install should install all the required dependencies, including Ionic 5.

Ionic still creates v1 projects even after upgrading v2

I'm trying to start an Ionic v2 project following the official docs here, but I end up with an Ionic v1 project every time. My steps:
Remove current ionic and install the beta:
$ npm uninstall ionic -g
$ npm install ionic#beta -g
/Users/mike/.npm-global/bin/ionic -> /Users/mike/.npm-global/lib/node_modules/ionic/bin/ionic
/Users/mike/.npm-global/lib
└── ionic#2.0.0-beta.32
Create a new Ionic v2 TypeScript project:
$ ionic start ionic2-test --v2 --ts
Creating Ionic app in folder /Users/mike/dev/ionic2-test based on tabs project
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================] 100% 0.0s
Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================] 100% 0.0s
Updated the hooks directory to have execute permissions
Update Config.xml
Initializing cordova project
Adding in iOS application by default
But a v1 project is created:
$ cat ./ionic2-test/www/lib/ionic/version.json
{
"version": "1.3.1",
"codename": "el salvador",
"date": "2016-05-12",
"time": "18:21:10"
}
$ head -2 ./ionic2-test/www/lib/ionic/js/angular/angular.js
/**
* #license AngularJS v1.5.3
My ionic info:
Cordova CLI: 5.4.0
Gulp version: CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.7.8
Ionic App Lib Version: 0.6.4
ios-deploy version: Not installed
ios-sim version: 5.0.3
OS: Mac OS X El Capitan
Node Version: v5.0.0
Xcode version: Xcode 7.3 Build version 7D175
What am I doing wrong?
So, the problem is that the Ionic CLI is not being updated to the latest one (2.0.0 beta-32). Have you tried by doing this:
After $ npm uninstall ionic -g, update npm and clean npm's cache:
npm cache clean -f
npm install npm -g
Delete manually any folder containing references to Ionic like those you've included in the question:
/Users/mike/.npm-global/bin/ionic
/Users/mike/.npm-global/lib/node_modules/ionic/bin/ionic
/Users/mike/.npm-global/lib
And then after that:
$ npm install -g ionic#beta
or (on Mac and Linux you’ll need to add sudo to install Ionic globally):
$ sudo npm install -g ionic#beta
#sebaferreras lead me to the solution.
Even after sudo npm uninstall ionic -g, the ionic command was still available:
$ which ionic
/usr/local/bin/ionic
So I think I must have had it installed in multiple places. There seemed to be something generally screwed up with my node installation (I possibly installed from homebrew as well as from the official .pkg download), so I decided to completely remove it all and start from scratch, as described here:
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
I then reinstalled node using the official .pkg from their website, su-did npm install -g ionic#beta, and now...
$ ionic info
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
...
So I'm all fixed up!
this link will solve and save your time: http://ionicframework.com/docs/v2/getting-started/installation/
the simple way to create a ionic project: go to your into the directory where you want to create you project and the type this cmd:
ionic start cutePuppyPics --v2
Your Ionic CLI is not updated yet. Just run the command "npm install ionic cordova" once again, no need to uninstall the previous version manually. It will override the previous version automatically.
Just for your future help: To build you first app in Ionic, You might need to update jdk to 1.8, sdk to latest one from sdk manager (no need to change target sdk) and the first build will download a number of Gradle files, so, good Internet connection is needed.

Ionic 2 & Ionic 1 work on different Node Versions

I was having some major build issues with Ionic 1.7.14 on NodeJS v6. Here you can see the problem and some of the solution that people offered me.
ionic.project has been renamed to ionic.config.json, please rename it.
For the past 6 months I have been working and two Ionic 1 Apps. earlier last month I began to work with Ionic 2. So I installed it via npm.. It all seem well I was working on Ionic 2 apps but did not quite connect the dots as to why all of the sudden I could not build anything on my past Ionic 1 apps.
FIRST SOLUTION:
I re-install Ionic 1.7.14 and I downgraded from Node 6.0 to Node 4.4.4 - voila! It was working once again! Ionic 1 was building and the CLI understood all my commands.. No more errors.
THE CONSEQUENCES:
I had to always make sure I was using Node 4.4.4 whenever I wanted to work on Ionic 1.7.x apps.. I use NVM so a simple nvm use 4.4.4 would do the trick.
But when I tried to work on Ionic 2 apps I realized that Ionic 2 was no longer installed and there for had to be re-installed, again. So I did..
RE-OCCURING ISSUE:
After re-installing Ionic 2, working a bit on that app then moving on to continue working on my other Ionic 1 app I realized that when I tried to run ionic serve the CLI gave me some errors which led me to believe I did not have ionic 1 installed.. WTH!? Here we go again.. re-install Ionic 1 version 1.7.x
Later I tried to ionic serve an Ionic 2 app and gulp was not running the build.. It serve the app to the browser but none of my code was being built and implemented into the app. I then realized that the CLI was not running my commands as Ionic 2 but Ionic 1.. What now? You guessed it. I had to re-install Ionic 2
THE CONNECTION between Ionic and Node versions
So yes, It took me a while to make the connection and I still don't quite understand why this is happening but I've found out that I do not need to repeatedly install Ionic versions as I wish to use them.. I just have to switch between Node Versions instead.
Ionic 2 --> works with Node 6.x
Ionic 1 --> works with Node 4.4.4
As long as I am using the respective Node Version with each I have no issues. BUT is this practical? Is there something wrong with my installs and file paths? I am curious if anyone has the same issue.
The following worked for me, not sure if all the steps are necessary.
I've followed these tips:
https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using- npm
https://forum.ionicframework.com/t/ionic2-cli-doesnt-run-gulp-tasks-on-i
onic-serve/49085/6
Your system information:
Cordova CLI: 6.3.1 Gulp version: CLI version 3.9.1 Gulp local:
Local version 3.9.1 Ionic Framework Version: 1.0.0-rc.0 Ionic CLI
Version: 2.1.0 Ionic App Lib Version: 2.1.0-beta.1 ios-deploy version:
1.8.5 ios-sim version: 5.0.8 OS: Mac OS X El Capitan Node Version: v4.4.4 Xcode version: Xcode 8.0 Build version 8A218a
I think the critical parts are:
Edit the gulpfile.js by adding gulp.task('serve:before', ['default']);
npm install --save-dev gulp-sass#2 (sudo if necessary)
downgrade node to v4.4.4 (big question mark about this step)
npm --production=false install (sudo if necessary)
Update to latest ionic CLI and just rename ionic.project to ionic.config.json... when you 'serve' for the first time, accept suggested installations.
For me it worked right away on the Node 7.7.1,
but with Node 8.1.4 I had to:
1. install Python (add PYTHON env variable)
///navigate to ionic 1 project
2. npm install node-gyp --save
3. npm install bcrypt --save
4. npm install node-sass --save
5. npm rebuild node-sass
6. npm install --save #ionic/cli-plugin-ionic1
// ionic serve
I hope it helps...

update to the latest ionic version

after ionic team has officially released ionic 1.2 versions
I checked
ionic -v
command to get my current version and I found it 1.7.12, then I did
npm install -g ionic
hopefully to update my current version and it just still on the previous version 1.7.12, so what is just the command I have to run to get the ionic 1.2 instead of ionic 1 which I already have now?
It is not a bug in npm, the 1.7.12 version that is shown when you run:
ionic -v
1.7.12
is the ionic-cli version, the command line utility, you can find it here: https://www.npmjs.com/package/ionic
The ionic 1.2 version that you are expecting, is the ionic framework version: http://code.ionicframework.com/# latest is 1.2.4 - Copenhagen
If you want to check the framework version that your app is running, go to your app directory and type:
ionic lib
Local Ionic version: 1.2.4 (<path>/myApp/www/lib/ionic/version.json)
Latest Ionic version: 1.2.4 (released 2016-01-08)
* Local version up to date
It may be bug with npm.
First Uninstall ionic and cordova using
npm uninstall cordova ionic
Then update node and npm
Install cordova and ionic
npm install -g cordova ionic
Check the version.
you can always run
sudo npm uninstall -g ionic && sudo npm install ionic

what is the latest version of ionic build 1.1.0 or 1.6.4

I installed ionic using the following command:
npm install -g ionic
After navigating to node_modules/ionic folder on my local machine and opening the package.json file, it says that the version is 1.6.4
However the ionicframework.com website says the latest version is
1.1.0 "xenon-xerus"
This is quiet confusing. Can someone clarify
You need to differentiate between the ionic CLI (version 1.6.4) and the ionic lib in your application project (version 1.1.0).
if you type ionic -v you'll get the version of the CLI (command line interface)
if you go into your project folder and type ionic lib you'll get the lib version.
Btw: You update the library with ionic lib update
Latest version: 1.7.8
Run npm install -g ionic to update
check version ----
ionic --version
1.7.8
run following command in terminal/cmd: ionic info that command will give you full details of ionic and Cordova installed in your pc and project.
And then you can use npm install -g ionic for install latest ionic build.