"ionic lib update" provides corrupted files


#1

Hi,

I have tried to update Ionic via CLI with “ionic lib update” command. But some installed files are corrupted or missing.

But I have made several attempts ant the errors are not always the same ! I don’t understand what the hell’s been happening here…

Thank you for your help.


#2

first run

npm install -g ionic 

then run

ionic lib update 

in the root of your cordova project


#3

@sjerd : Thank you for your answer.

I have updated ionic CLI to latest relalease (1.2.4) before running “ionic lib update”.


#4

Hi,

I have updated CLI to 1.2.5 and tried to update to Ionic Beta 13. But the issue is still here. I have tried on Windows 7 (node.js v0.10.29) and Mac OS 10.9.4 (node.js v0.10.28).

Very strange…


#5

Can u show us some of that error logs?


#6

I am getting this error after performing a ionic lib update to beta13, when trying to load the bundle ?

SyntaxError: Unexpected token )


#7

That error happends only in your current porject ? Try to start another app as example ( codepen.io would be nice idea, por example "ionic start appname http://codepen.io/ionic/pen/GpCst " ) and then try do what @sjerd tells to you ( ionic lib update ) in the root of your cordova project.

Tell me how it goes :slight_smile:


#8

I’m also getting error after updating CLI and my project’s lib. My app just does not start. It gives following errors.

Uncaught SyntaxError: Unexpected identifier ionic.bundle.js:507
Uncaught ReferenceError: angular is not defined app.js:6
Uncaught ReferenceError: angular is not defined controllers.js:1
Uncaught ReferenceError: angular is not defined services.js:1
Uncaught TypeError: Cannot read property ‘directive’ of undefined


#9

There is a major bug in the CLI when using ‘ionic lib update’. Until then the only solution is to just download the latest zip and copy into your projects.


Ionic lib update - ECONFLICT Unable to find suitable version for angular
#10

I was experiencing those errors too. Just download the zip file and extract into www/lib/ionic in your project.


#11

I haven’t had these errors. Pushing the latest release trying to update to current version v1.0.13 with npm install -g ionic and ionic lib update told my cordova project that it was still in v1.0.12 when trying to update the lib and cached the git. so i changed my bower.json to

    {
  "name": "HelloIonic",
  "private": "true",
  "devDependencies": {
    "ionic": "driftyco/ionic-bower#1.0.0-beta.13"
  },
  "resolutions": {
    "angular": "~1.2.17"
  }
}

And when trying to run ionic lib update again it got the current version v1.0.13
and experienced a bower error stating:

bower      ECONFLICT unbale to find suitable version for collide 

so i went to the official ionic github, found the bower.json went to ROOTOFYOURPROJECT\www\lib\ionic and changed those two bower.json files to:

    {
  "name": "ionic",
  "version": "1.0.0-beta.13",
  "codename": "lanthanum-leopard",
  "homepage": "https://github.com/driftyco/ionic",
  "authors": [
    "Max Lynch <max@drifty.com>",
    "Adam Bradley <adam@drifty.com>",
    "Ben Sperry <ben@drifty.com>"
  ],
  "description": "Advanced HTML5 hybrid mobile app development framework.",
  "main": [
    "release/css/ionic.css",
    "release/fonts/*",
    "release/js/ionic.js",
    "release/js/ionic-angular.js"
  ],
  "keywords": [
    "mobile",
    "html5",
    "ionic",
    "cordova",
    "phonegap",
    "trigger",
    "triggerio",
    "angularjs",
    "angular"
  ],
  "license": "MIT",
  "private": false,
  "ignore": [
    "**/.*",
    "CONTRIBUTING.md",
    "Gruntfile.js",
    "component.json",
    "config",
    "examples",
    "package.json",
    "release/js/angular",
    "release/js/angular-ui",
    "scripts",
    "test",
    "js/controllers",
    "js/ext",
    "js/utils",
    "js/views",
    "js/_license.js",
    "js/ionic.js"
  ],
  "dependencies": {
    "angular": "~1.2.17",
    "angular-animate": "~1.2.17",
    "angular-sanitize": "~1.2.17",
    "angular-ui-router": "0.2.10",
    "collide": "1.0.0-beta.3"
  }
}

Ran ionic lib update again and then it ran successful :slight_smile: hope it helps someone!

Full log:

    D:\wamp\www\Ionic\WeAlert>ionic lib update
bower ionic#1.0.0-beta.13   not-cached git://github.com/driftyco/ionic-bower.git
#1.0.0-beta.13
bower ionic#1.0.0-beta.13      resolve git://github.com/driftyco/ionic-bower.git
#1.0.0-beta.13
bower ionic#1.0.0-beta.13     download https://github.com/driftyco/ionic-bower/a
rchive/v1.0.0-beta.13.tar.gz
bower ionic#1.0.0-beta.13      extract archive.tar.gz
bower ionic#1.0.0-beta.13     resolved git://github.com/driftyco/ionic-bower.git
#1.0.0-beta.13
bower collide#1.0.0-beta.3  not-cached git://github.com/driftyco/collide.git#1.0
.0-beta.3
bower collide#1.0.0-beta.3     resolve git://github.com/driftyco/collide.git#1.0
.0-beta.3
bower collide#1.0.0-beta.3    download https://github.com/driftyco/collide/archi
ve/v1.0.0-beta.3.tar.gz
bower collide#1.0.0-beta.3     extract archive.tar.gz
bower collide#1.0.0-beta.3    resolved git://github.com/driftyco/collide.git#1.0
.0-beta.3
bower                        ECONFLICT Unable to find suitable version for colli
de

D:\wamp\www\Ionic\WeAlert>ionic lib update
bower ionic#1.0.0-beta.13       cached git://github.com/driftyco/ionic-bower.git
#1.0.0-beta.13
bower ionic#1.0.0-beta.13     validate 1.0.0-beta.13 against git://github.com/dr
iftyco/ionic-bower.git#1.0.0-beta.13
bower collide#1.0.0-beta.3      cached git://github.com/driftyco/collide.git#1.0
.0-beta.3
bower collide#1.0.0-beta.3    validate 1.0.0-beta.3 against git://github.com/dri
ftyco/collide.git#1.0.0-beta.3
bower collide#1.0.0-beta.3     install collide#1.0.0-beta.3
bower ionic#1.0.0-beta.13      install ionic#1.0.0-beta.13

collide#1.0.0-beta.3 www\lib\collide

ionic#1.0.0-beta.13 www\lib\ionic
├── angular#1.2.25
├── angular-animate#1.2.20
├── angular-sanitize#1.2.20
├── angular-ui-router#0.2.10
└── collide#1.0.0-beta.3

#12

I’m the someone your post helped, sjerd. Many thanks!


#13

I’m trying to update to Beta14, and your post had helped me, however there are some changes I had to do so it would be compatible with Beta14.

First off, I changed the bower.json file in the root folder of project / to be ionic version 14:

{
  "name": "flight",
  "private": "true",
  "devDependencies": {
    "ionic": "driftyco/ionic-bower#1.0.0-beta.14"
  }
}

Which worked fine for me, however, the problem I ran into is that version 14 uses a new version of angular which caused me a lot of problems with the second bower.json file in /www/lib/ionic. Instead of trying to resolve all the new versions within that file, I removed the second bower.json file contained within ionic folder, using these commands:

git rm .bower.json
git rm bower.json

So, after modifying the root bower.json and deleting all the bower.json files in the ionic folder, then I navigated back to the root folder and ran ionic lib update. Then, it asked me if I wanted to proceed (yes) and this was the result:

Unable to load ionic lib version information
Are you sure you want to replace /ionic/flight_test_beta14/www/lib/ionic with an updated version of Ionic?
(yes/no): yes
Latest version: 1.0.0-beta.14  (released 2014-12-15)
Downloading: https://github.com/driftyco/ionic-bower/archive/v1.0.0-beta.14.zip
Ionic version updated to: 1.0.0-beta.14

This seems to have worked for me. Note, that there is no bower.json file in the new structure located in the /www/lib/ionic folder, now it is version.json and correctly shows the new version:

{
  "version": "1.0.0-beta.14",
  "codename": "magnesium-mongoose",
  "date": "2014-12-15"
}

Also I had to remove any dependencies that were not compatible with Angular 1.3 in my root bower.json before this would work properly.

I hope this helps anyone struggling to update their project the new version of Ionic Beta 14!