Skip to content

ionic upload fails with differing project structure #1332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gruppjo opened this issue Sep 2, 2016 · 11 comments
Closed

ionic upload fails with differing project structure #1332

gruppjo opened this issue Sep 2, 2016 · 11 comments

Comments

@gruppjo
Copy link

gruppjo commented Sep 2, 2016

@dwieeb, @jthoms1. I hope it's alright if I directly mention you in this issue.

I'm currently trying to make integration of ionic-cloud work with Generator-M-Ionic projects and update our ionic integration guide. Integration seemed fairly easy apart ionic-cloud not being available through bower. For which I created an issue: ionic-team/legacy-ionic-cloud#43. However I need ionic upload to work with our project structure. In recent versions of the Ionic CLI ionic upload was satisfied as long as the following criteria were met:

  • an uploadable app in www/, mainly an existing index.html seemed important
  • presence and proper configuration of ionic.config.json and .io-config.json

Unfortunately this no longer works with v2.0.0. I get the following error when running ionic upload:

$ ionic upload
Uploading app....
Saved app_id, writing to ionic.io.bundle.min.js...

Caught exception:
 TypeError: Can't call method on  undefined
    at TypeError (native)
    at module.exports (/Users/jonathan/Projects/play/test2/node_modules/core-js/modules/_defined.js:3:28)
    at createHTML (/Users/jonathan/Projects/play/test2/node_modules/core-js/modules/_string-html.js:7:19)
    at bold (/Users/jonathan/Projects/play/test2/node_modules/core-js/modules/es6.string.bold.js:5:12)
    at cb (/usr/local/lib/node_modules/ionic/node_modules/winston/lib/winston/logger.js:206:7)
    at done (/usr/local/lib/node_modules/ionic/node_modules/async/lib/async.js:167:19)
    at /usr/local/lib/node_modules/ionic/node_modules/async/lib/async.js:40:16
    at /usr/local/lib/node_modules/ionic/node_modules/winston/lib/winston/logger.js:193:9
    at Console.log (/usr/local/lib/node_modules/ionic/node_modules/winston/lib/winston/transports/console.js:127:3)
    at emit (/usr/local/lib/node_modules/ionic/node_modules/winston/lib/winston/logger.js:186:17)
    at /usr/local/lib/node_modules/ionic/node_modules/async/lib/async.js:157:13
    at _each (/usr/local/lib/node_modules/ionic/node_modules/async/lib/async.js:57:9)
    at Object.async.each (/usr/local/lib/node_modules/ionic/node_modules/async/lib/async.js:156:9)
    at Logger.log (/usr/local/lib/node_modules/ionic/node_modules/winston/lib/winston/logger.js:214:9)
    at target.(anonymous function) [as info] (/usr/local/lib/node_modules/ionic/node_modules/winston/lib/winston/common.js:54:18)
    at Request._callback (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/upload.js:150:11) 

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

One of our users had this issue before but I failed to track it down mway-io/generator-m-ionic#409.

With version v2.0.0 I can reliably reproduce this issue now and was able to track down the error to the following two lines of code in the Ionic CLI: https://github.com/driftyco/ionic-app-lib/blob/master/lib/upload.js#L150-L151 Apparently log is undefined at this point. Not sure why. By commenting those lines, I got ionic upload to work.

In my discussion with @tlancina in march (#845) I think he mentioned that other project structures should technically be supported. So my question is: am I doing something wrong? How can I get around this to allow our users to reliably upload to ionic?

@gruppjo
Copy link
Author

gruppjo commented Sep 2, 2016

I created a repo especially for this case that you can use to reproduce this issue.
It contains a valid ionic.config.json and .io-config.json

Setup

git clone https://github.com/mwaylabs/generator-m-ionic-demo/tree/ionic-cloud
cd generator-m-ionic-demo
npm i && bower i

Then you should replace the app_id with a valid one of your account in both config files. Then run:

gulp watch # to see if everything is working
gulp build   # build into www/ folder
ionic upload # with version 2.0.0

You then should get the same error as above.

Uncomment these lines in your installation of ionic-cli and it will work: https://github.com/driftyco/ionic-app-lib/blob/master/lib/upload.js#L150-L151

Open Ionic View and tada!

@mjaworski-eab
Copy link

mjaworski-eab commented Sep 6, 2016

I have the exact same issue; but it does not seem critical because the file does upload. +1

@gruppjo
Copy link
Author

gruppjo commented Sep 7, 2016

@jaworskm, oh! It never occurred to me to check. Thanks!

@coderroggie
Copy link

coderroggie commented Sep 12, 2016

This looks similar to the issue found here: #984. I'm guessing commenting out line 150 in /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/upload.js would fix the issue, similar to how the fix described in the other issue fixes it. Pretty sure that is a hack though.

@demus
Copy link

demus commented Sep 14, 2016

this is essentially the same issue with bold in #1038 and prevents me from uploading to the ionic cloud unless I delete bold from lines 150 and 151.

there's an issue about bold at #1344 but the issue seems to appear in multiple places.

@gruppjo
Copy link
Author

gruppjo commented Sep 14, 2016

@sdemurjian it's not closed.

@demus
Copy link

demus commented Sep 14, 2016

@gruppjo Oops, sorry. I think I mixed up this issue with the other one -- Editing my comment to reflect this

@gruppjo
Copy link
Author

gruppjo commented Sep 14, 2016

I find it confusing some times as well, when linked issues are closed ;)

@coderroggie
Copy link

Still having this issue after upgrading to version 2.1.0 of the CLI.

@coderroggie
Copy link

Upgrading the ionic-cli to version 2.1.6 fixed the issue for me. I believe the commit that fixed it was #1605

@lvl-42
Copy link

lvl-42 commented Nov 12, 2016

I've got this issue with the version 2.1.4 of the CLI
With 2.1.8 version it's OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants