ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

ionic state reset : Caught exception: undefined

Open crouti opened this issue 10 years ago • 11 comments

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

crouti avatar Nov 14 '16 13:11 crouti

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.

fmluizao avatar Nov 15 '16 21:11 fmluizao

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.

fmluizao avatar Nov 17 '16 12:11 fmluizao

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

vjanssens avatar Nov 25 '16 09:11 vjanssens

Maybe ionic state is going to disappear?

fmluizao avatar Nov 25 '16 10:11 fmluizao

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

abennouna avatar Dec 29 '16 13:12 abennouna

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 .

mounir1 avatar Feb 12 '17 19:02 mounir1

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

AndersonFriaca avatar Mar 21 '17 20:03 AndersonFriaca

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

leandrogehlen avatar Apr 04 '17 23:04 leandrogehlen

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

planck4 avatar Apr 19 '17 11:04 planck4

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

nebulr avatar Jun 26 '17 15:06 nebulr

See npm-debug.log file in project folder.

jhlee8804 avatar Nov 24 '17 02:11 jhlee8804