Ionic 2: How to update Ionic library for an existing project? - ionic-framework

Can't find any info on Ionic 2 website. For example, a project is created with Ionic library 2.0.1. How do I update it to Ionic library 2.1.0? What is the standard procedure? ionic lib update is deprecated.

If you want to update your CLI, you need to run:
npm install -g ionic#latest
For updating your project, open your package.json and update the version of ionic-angular entry and any other dependencies that need to be updated. Reference to a package.json is here which is the one that is downloaded when you start a new project.
Then delete your projects node_modules and run:
npm install in your project directory.

You can also go to your project directory and type:
npm install ionic-angular#latest --save
npm install #ionic/app-scripts#latest --save-dev
In my case, npm install -g ionic#latest installed globally the latest ionic but it didn't update the ionic version of my project. Only the above solution worked.
PS 1: I'm using ionic 3
PS 2: Delete the project's folder node_modules, in case of errors

Related

How to solve: Detected locally installed Ionic CLI, but it’s too old -- using global CLI?

ionic -v results in this warning:
[WARN] Detected locally installed Ionic CLI, but it’s too old -- using global CLI.
How to uninstall local Ionic CLI?
ionic-cli has been updated to version 4.0.1 a couple of days ago.
https://github.com/ionic-team/ionic-cli/blob/develop/CHANGELOG.md
You should remove local cli by npm remove ionic --save-dev and use global one instead.
npm i -g ionic
PS: For ionic v1 project, you have to install #ionic/v1-toolkit now.
https://www.npmjs.com/package/#ionic/v1-toolkit
I had this issue on my app as well.
I no longer had '#ionic/cli' or 'ionic' as a dependency, but every time I re-ran "npm i" it would return as a locally installed item. Looking through my package-lock.json I saw that it was also being installed as a dependency of #types/ionic which I then removed and solved this issue as well.
Remove old ionic:
npm remove ionic
And then install ionic v 4.0.1:
npm install ionic#latest --save
Remove local Ionic CLI npm package:
npm rm ionic --save

Ionic: Unable to run ionic serve with WARN:ionic project has been renamed to ionic.config.json

My folder for ionic is working in the working but without doing anything, it can not run with command ionic serve. It ask to change ionic.project or run npm bower install. I choose to install bower and it shown "WARN: ionic.project has been renamed to ionic.config.json, please rename it.". rename it and run ionic serve but the app doesn't appear.
The method I rename the ionic.project is press F2 and change to "ionic.config.json"
D:\app_abc\abc\.git\cha>ionic service
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
You must have bower installed to continue.
Type `npm install -g bower` (CLI v2.0.0-beta.25)
Your system information:
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 1.3.1
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS:
Node Version: v5.11.1
D:\abc\abc\.git\cha>npm install -g bower
C:\Users\jane\AppData\Roaming\npm\bower -> C:\Users\jane\AppData\Roaming\npm\node_modules\bower\bin\bower
C:\Users\jane\AppData\Roaming\npm
`-- bower#1.8.0
D:\abc\abc\.git\cha>ionic service
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
D:\abc\abc\.git\cha>ionic service
D:\abc\abc\.git\cha>ionic service
Couldn't find ionic.config.json file. Are you in an Ionic project?
you are not in ionic project. So it is throwing error.
Example: your project name is ioninProject
Then, path should be like this
D:\abc\abc.git\cha\ionicProject>ionic service

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.

How can I update to the not yet officially released Ionic 1.2?

Ionic 1.2 has been announced:
http://blog.ionic.io/announcing-ionic-1-2/
The source code is availible here:
https://github.com/driftyco/ionic/releases/tag/v1.2.0
But I haven't been able to install with with some shell commands that I have attempted:
$ bower install --save ionic#1.2.0
$ bower install https://github.com/driftyco/ionic/archive/v1.2.0.tar.gz
$ bower install driftyco/ionic-bower#v1.2.0 --force
I can download the source code but don't know how to use it to update my ionic framework
You can install it with bower using:
$ bower install ionic#1.2.0 --force
Anyway, you should take into account that this will only download libraries and source code, but not a CLI tool.
So in my opinion, if you want to test ionic 1.2, you should
Create an ionic project (as usual)
Perform bower install ionic#1.2.0 --force, in order to get the new ionic libs
Replace in your project the content of www/lib/ionic/ with the content of the recently downloaded bower_components/ionic/release/.
DETAIL: Ionic uses to include a .bowerrc file that causes bower packages to be placed in www/lib, instead of inside bower_components, so maybe you'll simply need to replace the content of www/lib/ionic/ with www/lib/ionic/release (--force is need because www/lib/ionic already exists).

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.