1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    44
    Answers
    1
    Vote Rating
    3
    dkamins is on a distinguished road

      0  

    Default Answered: sencha app build error: [ERROR] Cannot read property 'package' of undefined

    Answered: sencha app build error: [ERROR] Cannot read property 'package' of undefined


    Suddenly (i.e. this worked previously, and I'm not aware of changing anything, but it's possible) I'm no longer able to run the sencha command to build my app. This is what I get:


    Code:
    $ sencha app build -e native
    
    [ERROR] Cannot read property 'package' of undefined
    I can't find any reference to this error on Google or in this forum. What could have happened?

  2. As I said in previous message, my `app.js` file had somehow been overwritten somehow by a minified version (not sure if it was same content or not).

    I found that my `app.json` file had ALSO been overwritten by a minified version, but this time definitely with some missing data. The original file (untouched from `sencha generate app`) was 113 lines long, a dict with 9 keys. The new version was a single line, a dict with only 3 keys (id, js, css):

    Code:
    {"id":"2fbc1970-6ee8-11e1-ae8f-a12dda45cba8","js":[{"path":"sdk/sencha-touch.js","type":"js"},{"path":"app.js","update":"delta","type":"js"}],"css":[{"path":"resources/css/app.css","update":"delta","type":"css"}]}
    I'm 90% sure there is a bug in some of part of the Sencha command that did this. The remaining 10% is devoted to my potential stupidity or faulty build scripts. But AFAIK I've never touched that file.

    The error I was getting ("Cannot read property 'package' of undefined") was due to the fact that the "buildPaths" key from app.json was missing, and thus the "package" sub-key of that dict was missing. I restored the app.json from a freshly generated app, and everything is working again.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This looks like a JS error in your code. Do you use the package property in any property like in the config object?

    Code:
    config : {
        foo : bar.package
    }
    This error sounds like bar would be undefined.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    44
    Answers
    1
    Vote Rating
    3
    dkamins is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    This looks like a JS error in your code. Do you use the package property in any property like in the config object?
    No, and in fact my app works fine when browsed with Safari. It is only the build that yields this odd error.

    (On a side note, my "app.js" file was overwritten recently with a ~375 KB single line JS file recently (that looked like lots of minified ST code). I don't know where it came from, but I'm wondering if one of the build tools got confused and trashed parts of the SDK...)

  5. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    44
    Answers
    1
    Vote Rating
    3
    dkamins is on a distinguished road

      0  

    Default Problem solved. Cause unknown. Suspect bug in Sencha command / build tools.

    Problem solved. Cause unknown. Suspect bug in Sencha command / build tools.


    As I said in previous message, my `app.js` file had somehow been overwritten somehow by a minified version (not sure if it was same content or not).

    I found that my `app.json` file had ALSO been overwritten by a minified version, but this time definitely with some missing data. The original file (untouched from `sencha generate app`) was 113 lines long, a dict with 9 keys. The new version was a single line, a dict with only 3 keys (id, js, css):

    Code:
    {"id":"2fbc1970-6ee8-11e1-ae8f-a12dda45cba8","js":[{"path":"sdk/sencha-touch.js","type":"js"},{"path":"app.js","update":"delta","type":"js"}],"css":[{"path":"resources/css/app.css","update":"delta","type":"css"}]}
    I'm 90% sure there is a bug in some of part of the Sencha command that did this. The remaining 10% is devoted to my potential stupidity or faulty build scripts. But AFAIK I've never touched that file.

    The error I was getting ("Cannot read property 'package' of undefined") was due to the fact that the "buildPaths" key from app.json was missing, and thus the "package" sub-key of that dict was missing. I restored the app.json from a freshly generated app, and everything is working again.

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This would be very odd. I have run builds many times and app.js and app.json are never touched.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #6
    Sencha User
    Join Date
    Mar 2013
    Posts
    1
    Vote Rating
    0
    h.schwarz is on a distinguished road

      0  

    Default the same behavior

    the same behavior


    I have the same problem: after build process the app.json file is changed and minified. Definitely a bug.