Ionic still creates v1 projects even after upgrading v2 - ionic-framework

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.

Related

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...

ionic 1 app does not build ios : ionic.project has been renamed to ionic.config.json,

I am working on an Ionic 1 app with a remote team and lately our versions have not liked each other. I was wondering if the fact that I have also been working on Ionic 2 projects for whatever reason my CLI "thinks" these apps are also Ionic 2 and there for is shooting me the error below?
ionic build ios
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
(node:9061) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'bower'
Do you need to run `npm install`?
I have ran npm install.. does not make it go away.. I also have make sure to have bower installed.
What does this hold up here have to do with? I've been stuck here for a couple days now.
UPDATE
I went to an old project that and i tried to run ionic info to see the versions I have and system info but I get THE SAME error message..
I have no idea what I've done to get this...
mymac ~/code/92_AAC/newApp on master[!]
$ ionic info
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'gulp'
Do you need to run `npm install`?
UPDATE 2
I downgraded from Node 6 to Node 5.9 On the current project I was having the original issues.. I got this..
$ ionic build ios
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Install ios-sim to deploy iOS applications. `npm install -g ios-sim` (may require sudo)
Install ios-deploy to deploy iOS applications to devices. `npm install -g ios-deploy` (may require sudo)
******************************************************
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
(node:11866) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'bower'
Do you need to run `npm install`?
my ionic info(finally able to print it out)
Your system information:
Cordova CLI: 6.1.1
Gulp version: CLI version 1.2.1
Gulp local:
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.8.6
ios-sim version: 5.0.3
OS: Mac OS X El Capitan
Node Version: v5.9.1
Xcode version: Xcode 7.3.1 Build version 7D1014
UPDATE 3 after #janos suggestion
I ran npm install bower and it ran and installed some modules BUT I got the following..
click this link to see a screen shot of my command line in more detail
Screen Shot here!
```
$ ionic build ios
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
(node:12122) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
There is an error in your gulpfile:
Error: ENOENT: no such file or directory, scandir '/Users/abelista/code/inov/cornerstone/inov/a4c/passengerApp/trunk/passenger/node_modules/gulp-sass/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:945:18)
at Object.getInstalledBinaries (/Users/abelista/code/inov/cornerstone/inov/a4c/passengerApp/trunk/passenger/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:74:13)
at foundBinariesList (/Users/abelista/code/inov/cornerstone/inov/a4c/passengerApp/trunk/passenger/node_modules/gulp-sass/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/Users/abelista/code/inov/cornerstone/inov/a4c/passengerApp/trunk/passenger/node_modules/gulp-sass/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/Users/abelista/code/inov/cornerstone/inov/a4c/passengerApp/trunk/passenger/node_modules/gulp-sass/node_modules/node-sass/lib/errors.js:45:5)
at Object. (/Users/abelista/code/inov/cornerstone/inoabelista
```
List item: The main error (A4CPassenger#1.1.1 - not sure what to call this.. but this was basically the name of the app? I believe the remote team changed it.. for whatever reason I am still getting the old name..)
I was running Node 6.0.0 and I needed to run Node 4.4.4
Under the above conditions can not be resolved, consider the ionic version, I encountered the same problem, because the final version ionic problem. ionic version upgrade quickly, do the project two months ago, and now ionic been upgraded from 1.7.16 to 2.0.0 of. if you Want to re-run this version, you should enter cmd 'npm install ionic#1.7.16', after the run is completed, then the implementation of 'ionic serve' you can run an older version of the project.
I hope to help you
I got the same situation.
I had updated ionic from npm (because it said it is outdated) and I didn't realize I have to update npm too. So I have to update npm e remove and reinstall ionic.
# Update npm (downloaded from nodejs.org +6)
sudo npm remove ionic
sudo npm install -g ionic
Run npm uninstall --save-dev gulp-sass#2

Ionic error of Cordova lower version - Please install your Cordova CLI to version >=4.2.0

Installed Ionic successfully. When running ionic info and other commands like ionic browser --list, I get an error that cordova is lower then version 4.
Cordova is installed with no sudo and in global home directory.
> ionic info
Your system information:
Cordova CLI: 6.1.0 (cordova-lib#undefined)
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID: Ubuntu Description: Ubuntu 15.10
Node Version: v5.9.1
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly suggested to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
Cordova installation is at:
> which cordova
/home/user_1/.npm-global/bin/cordova
Ionic installation is at:
> which ionic
/home/user_1/.npm-global/bin/ionic
I am using cordova#6.2 and ionic#1.7 as well. After I got this error message, I opened a new terminal and typed cordova -v which outputted:
? May Cordova anonymously report usage statistics to improve the tool over time?
As soon as I entered my answer (No), the version number printed out and then I re-ran ionic info in my project terminal. The error was gone.
Caveats
I had just updated ionic#1.7.16 from 1.7.15. It's a very minor patch with one set of bug fixes that are not related to this.
The particular system that I had this problem with is running Windows 10.
The first time I ran ionic info in my project directory, I got the same error twice.
Original Error Output:
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
Your system information:
You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.2.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS:
Node Version: v4.4.2
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
I've tried a lot of different methods to resolve this, like reinstall with and without the --unsafe-perm=true --allow-root flags (which is how others advised to fix it on other questions/other places online) but it seems to be an issue with cordova at version 6.1.0 and ionic so for now use 6.0.0 by running
npm install -g cordova#6.0.0
That should do the trick as it is seems 6.1.0 isn't a stable version.
cordova telemetry off
Made the error disappear when running
ionic info
I chose to opt out of Telemetry which collects data during development for analytics. You can also opt in by using the "on" keyword instead.
Hat tip to Wayne Bloss for guiding me to this answer.
I had exactly the same result as Wayne Bloss on Windows 10. The error "> = 4.2.0" on the first attempt, and after checking the version "cordova -v", the error was gone (I answered Yes to the question on statistics).
As stated by Wayne Bloss this warning disappears when answering the question triggered by the command cordova -v. This worked also for my configuration using Cordova 6.3.1.
This works because the original reason for this is that the version information string for Cordova CLI not only contains the version number but also this piece of information "You have been opted out of telemetry. To change this, run: cordova telemetry on." which makes the internal evaluation of the string with semver return always false. Answering the telemetry question with "no" removed the string from the version thus making the warning message disappear.
I just ran into this so I found this page and seems like no proper answer so here is one.
Installing the cordova-cli deb package requires to:
Add the Ubuntu Cordova Personal Package Archive to your Ubuntu system
Install the cordova-cli package (and its dependencies)
So, for ubuntu
sudo apt-add-repository ppa:cordova-ubuntu/ppa
sudo apt-get update
sudo apt-get install cordova-cli
More info here
https://cordova.apache.org/docs/en/latest/guide/platforms/ubuntu/index.html
As others have noted, a possible cause of this is noise from cordova telemetry.
The issue is still present in cordova 6.5.0 and ionic 2.2.2.
As an additional piece of information, I would like to add that the following has to be run for the current user, e.g. if you have a CI system that installs cordova as root and then runs ionic as a non-privileged user, you will have to run
cordova telemetry off
again.
D:\>ionic start myapp blank
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
Creating an Ionic app in D:\myapp based on the blank template.
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
Downloading: https://github.com/driftyco/ionic-starter- blank/archive/master.zip
Installing npm packages (may take a minute or two)...
/
? ♫ ? ♫ Your Ionic app is ready to go! ? ♫ ? ♫
The Ionic application is started without any issue of Cordova updating.
You can however, use the following code to update:
npm update -g cordova
It's well written in the caveat, You need to install cordova in your npm using npm install -g cordova
or
npm install -g cordova#4.2.0
Problem solved!

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.