Ionic-cli: ionic state reset : Caught exception: undefined

Created on 14 Nov 2016  路  11Comments  路  Source: ionic-team/ionic-cli

ionic state reset

outputs:

Removed platforms and plugins
Attempting to restore your Ionic application from package.json

Restoring Platforms

cordova platform add android
cordova platform add ios

Restore platforms is complete

Restoring Plugins

cordova plugin add cordova-plugin-device
Caught exception:
 undefined 

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

my config is:

Your system information:

Cordova CLI: 6.4.0 
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
ios-deploy version: 1.8.2 
ios-sim version: 5.0.3 
OS: OS X El Capitan
Node Version: v5.2.0
Xcode version: Xcode 8.1 Build version 8B62

Most helpful comment

Running _sudo_ ionic state reset fixed it for me on Mac.

All 11 comments

Same here...

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.39
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.1.0
Xcode version: Not installed

The problem is with ionic-app-lib. Upgrading to 2.1.5 solves the problem.

Looks like its already fixed by https://github.com/driftyco/ionic-cli/commit/9667f3d211b08478f28418b400f57bd40eada8d4, but it's not released on npm yet.

I was wrong about ionic-app-lib...

I have another project with the exact versions of my previous "ionic info", except that this project was generated with a beta version of Ionic, and upgraded to 2.0.0-rc.2 later, and everything works.

With a fresh project, the problem appears.

So I think the issue is with some dependency version. I tried to diff node_modules on both projects, but can't figure out what was wrong.

Hope this helps to bissect the problem.

I'm having the same issue after a ionic state restore (closed my own issue #1723 after seeing this one).

Putting the gist of my issue below:

$ ionic state restore
Attempting to restore your Ionic application from package.json

Restoring Platforms

cordova platform add ios
cordova platform add ios

Restore platforms is complete

Restoring Plugins

cordova plugin add cordova-plugin-whitelist
Caught exception:
undefined

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

What behavior are you expecting?

Normal ionic state restore command (adding platforms and plugins from package.json)

Steps to reproduce:

  1. $ ionic state restore
package.json
{
  "name": "app",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "ionic-angular": "2.0.0-rc.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.45",
    "typescript": "2.0.6"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "cordova-plugin-network-information",
    "cordova-plugin-file-transfer",
    "cordova-plugin-file"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "An Ionic project"
}

Post the output of ionic info below please

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.11
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62

Maybe _ionic state_ is going to disappear?

Edited as (too verbose) duplicate of: https://github.com/driftyco/ionic-cli/issues/784#issuecomment-261511405 ;)

I had similar problem! I deleted node_modules files and reinstalled ionic and cordova from scratch
$ cd /usr/local/lib/node_modules/ rm -rf *
$ brew install node
and problem solved .

Make sure the names of installed plugins are the same as the "Cordova Plugins" site

I had the same problem with the call-number plugin
In the fetch.json file in ./plugins the name was different than it was to be
Example:
Previous =

"Mx.ferreyra.callnumber": {
         "Source": {
             "Type": "registry",
             "Id": "call-number"
         },
         "Is_top_level": true,
         "Variables": {}
     }

New =

"Call-number": {
         "Source": {
             "Type": "git",
             "Url": "https://github.com/Rohfosho/CordovaCallNumberPlugin.git",
             "Subdir": "."
         },
         "Is_top_level": true,
         "Variables": {}
     }

I solved by adding the plugin directly through the git url
Example:
Cordova plugin add https://github.com/Rohfosho/CordovaCallNumberPlugin.git

I think that i found the problem.

To me, when it was necessary to update the ionic version, this error started to happens

To solve the problem i changed the config.xml for configurations compatible with latest version

Running _sudo_ ionic state reset fixed it for me on Mac.

@rajatkhare619 this fixed it must be a permissions issue somewhere. However shouldn't need to call sudo ..

See npm-debug.log file in project folder.

Was this page helpful?
0 / 5 - 0 ratings