-
12 Apr 2012 9:18 AM #1
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:
I can't find any reference to this error on Google or in this forum. What could have happened?Code:$ sencha app build -e native [ERROR] Cannot read property 'package' of undefined
-
Best Answer Posted by dkamins
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):
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.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"}]}
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.
-
12 Apr 2012 10:18 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
- Answers
- 3102
This looks like a JS error in your code. Do you use the package property in any property like in the config object?
This error sounds like bar would be undefined.Code:config : { foo : bar.package }Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Apr 2012 11:19 AM #3
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...)
-
12 Apr 2012 3:47 PM #4
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):
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.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"}]}
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.
-
13 Apr 2012 4:16 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
- Answers
- 3102
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Mar 2013 7:55 AM #6
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.


Reply With Quote