0

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?

Mike Chamberlain
  • 29,972
  • 27
  • 103
  • 151

4 Answers4

1

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
  • 41,734
  • 10
  • 105
  • 127
0

@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!

Community
  • 1
  • 1
Mike Chamberlain
  • 29,972
  • 27
  • 103
  • 151
0

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

0

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.

Jannat Tumpa
  • 101
  • 12