Bug - ionic state reset fails if missing www folder
ISSUE
ionic state reset fails if I don't have www folder. Throws following error:
$ ionic state reset
Removed platforms and plugins
Attempting to restore your Ionic application from package.json
Restoring Platforms
cordova platform add ios
Restore platforms is complete
Restoring Plugins
cordova plugin add cordova-plugin-console
Caught exception:
undefined
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
ionic plugin add fails with following error:
Error: Current working directory is not a Cordova-based project.
SOLUTION
To fix this, I ran ionic serve. It creates www directory. After that if I run ionic state reset or ionic plugin add, it works.
POSSIBLE ISSUE
Seems like cordova looks for config.xml in www folder and if that's missing, it doesn't work.
As of rc0, www folder is initially not there(generated by ionic serve), we are facing this issue.
VERBOSE
Executing cordova cli: plugin add cordova-plugin-console --verbose
Error: CordovaError: Current working directory is not a Cordova-based project.
at Object.cdProjectRoot (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js:139:15)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/plugin.js:48:40
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:810:14
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
REPRODUCE STEPS
- Clone ionic-conference-app
- npm install
- remove www folder
- ionic state reset
Related Issues
- https://github.com/driftyco/ionic-cli/issues/935
- https://github.com/driftyco/ionic/issues/2213
- https://github.com/driftyco/ionic/issues/1624
Tagging - @jgw96 @mhartington
Not really sure if it's worth mentioning but the same issue appears when running ionic state restore.
Also, ionic serve does not need to be run, an empty www folder makes the error go away as well.
Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.
Thank you for using Ionic!