ionic-team/ionic-cli

2.0.0-beta.20, 21, 22 state functionality broken

josschne opened this issue · 5 comments

Installing ionic 2.0.0-beta.20 through 22 and attempting any state commands results in the error below. Rewinding to 2.0.0-beta.19 without any other changes restores state functionality.

$ionic state restore

Error: Cannot find module './project'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/<myhomedir>/.nvm/versions/node/v5.9.0/lib/node_modules/ionic/lib/ionic/state.js:36:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)


Cannot find module './project' (CLI v2.0.0-beta.22)

Your system information:

Cordova CLI: 6.0.0
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.1
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.22
Ionic App Lib Version: 2.0.0-beta.12
OS: Distributor ID: Ubuntu Description: Ubuntu 15.10 
Node Version: v5.9.0

+1, here is an example with ionic-conference-app:

MacBook-Air:ionic-conference-app guille$ git pull
Already up-to-date.
MacBook-Air:ionic-conference-app guille$ ionic state reset

Error: Cannot find module './project'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/lib/ionic/state.js:36:18)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)


Cannot find module './project' (CLI v2.0.0-beta.22)

Your system information:

Cordova CLI: 6.0.0
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.22
Ionic App Lib Version: 2.0.0-beta.12
ios-deploy version: 1.8.5 
ios-sim version: 5.0.6 
OS: Mac OS X El Capitan
Node Version: v4.3.0
Xcode version: Xcode 7.2.1 Build version 7C1002 

Same with a new starter template

dors-mbp:temp dorgold$ ionic state restore

Error: Cannot find module './project'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/lib/ionic/state.js:36:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)


Cannot find module './project' (CLI v2.0.0-beta.22)

Your system information:

Cordova CLI: 6.0.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.22
Ionic App Lib Version: 2.0.0-beta.12
ios-deploy version: 1.8.5 
ios-sim version: 5.0.6 
OS: Mac OS X El Capitan
Node Version: v5.7.1
Xcode version: Xcode 7.2.1 Build version 7C1002 

We're facing the same issue and following seems to fix it:

inside ionic/lib/ionic/state.js

IonicProject = require('./project'),
IonicAppLib = require('ionic-app-lib'),

change it to:

IonicAppLib = require('ionic-app-lib'),
IonicProject = IonicAppLib.project,

This should be fixed as of beta.23, but just a heads up state will be deprecated in favor of the Cordova way: https://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/index.html

Meaning that plugins will be saved in config.xml not package.json.

Let me know if you're still having issues/concerns/thoughts, thanks!

I help solve this problem as:
xkris6x@NextSofts-Server:/home/project/web/nodeJS/ionic/oea$ ionic serve

There is an error in your gulpfile:
Error: /home/project/web/nodeJS/ionic/oea/node_modules/node-sass/vendor/linux-x64-47/binding.node: failed to map segment from shared object: Operation not permitted
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object. (/home/project/web/nodeJS/ionic/oea/node_modules/node-sass/lib/index.js:24:15)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)

xkris6x@NextSofts-Server:/home/project/web/nodeJS/ionic/oea$ ionic start

Invalid command (CLI v2.0.0-beta.32)

Your system information:

Cordova CLI: 6.2.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
OS: Distributor ID: Debian Description: Debian GNU/Linux 8.4 (jessie)