Results 1 to 6 of 6

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

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    44
    Answers
    1
    Vote Rating
    3
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    44
    Answers
    1
    Vote Rating
    3
      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
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    This would be very odd. I have run builds many times and app.js and app.json are never touched.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  7. #6
    Sencha User
    Join Date
    Mar 2013
    Posts
    1
    Vote Rating
    0
      0  

    Default the same behavior

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •