TooTallNate / plist.js

Mac OS X Plist parser/builder for Node.js and browsers
MIT License
571 stars 123 forks source link

Cannot read property 'nodeName' of null - info.plist ipa file #55

Open nvcken opened 9 years ago

nvcken commented 9 years ago

@TooTallNate I use this lib to read info.plist of ipa file.

var plist = require('plist');
var dl_file_path =  path.join(__dirname, '../upload/info.plist');

var obj = plist.parse(fs.readFileSync(dl_file_path, 'utf8'));
console.log(JSON.stringify(obj));

I got this error

TypeError: Cannot read property 'nodeName' of null
    at Object.parse (d:\Appota\appota_flight\node_modules\plist\lib\parse.js:45:26)
    at Object.exports.install [as handle] (d:\Appota\appota_flight\routes\upbuild.js:241:2
5)
    at next_layer (d:\Appota\appota_flight\node_modules\express\lib\router\route.js:103:13
)
    at Route.dispatch (d:\Appota\appota_flight\node_modules\express\lib\router\route.js:10
7:5)
    at d:\Appota\appota_flight\node_modules\express\lib\router\index.js:205:24
    at param (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:286:14)
    at param (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:298:16)
    at Function.proto.process_params (d:\Appota\appota_flight\node_modules\express\lib\rou
ter\index.js:314:3)
    at next (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:199:19)
    at next (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:176:38)
GET /ins/1415257358528 200 120001ms
 req install
TypeError: Cannot read property 'nodeName' of null
    at Object.parse (d:\Appota\appota_flight\node_modules\plist\lib\parse.js:45:26)
    at Object.exports.install [as handle] (d:\Appota\appota_flight\routes\upbuild.js:241:2
5)
    at next_layer (d:\Appota\appota_flight\node_modules\express\lib\router\route.js:103:13
)
    at Route.dispatch (d:\Appota\appota_flight\node_modules\express\lib\router\route.js:10
7:5)
    at d:\Appota\appota_flight\node_modules\express\lib\router\index.js:205:24
    at param (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:286:14)
    at param (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:298:16)
    at Function.proto.process_params (d:\Appota\appota_flight\node_modules\express\lib\rou
ter\index.js:314:3)
    at next (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:199:19)
    at next (d:\Appota\appota_flight\node_modules\express\lib\router\index.js:176:38)
SchulzKai commented 9 years ago

I ran into the same error. @nvcken - Did you figure out a way to fix it yet?

I am trying to parse the Info.plist file from an iPhone IPA package as well...

nvcken commented 9 years ago

@SchulzKai Hi , I have not find out yet,because urgent so I have use other module simple-plist

przemyslawpluta commented 9 years ago

Same issue here agains /Applications/VLC.app/Contents/Info.plist on osx 10.8.5

TypeError: Cannot read property 'nodeName' of null
    at Object.parse (/Users/usr/node_modules/plist/lib/parse.js:45:26)
    at Object.init (/Users/usr/sight.js:487:19)
    at Object.<anonymous> (/Users/usr/bin/sight:3:21)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
fizker commented 9 years ago

I found a strong correlation. I get the exact same error for a binary plist, but the same plist as XML parses fine.

The short term solution would be to convert the binary plist to either XML or JSON by use of objc or swift.

As Swift:

import Foundation
let d=NSDictionary(contentsOfFile:"binary.plist")!
if outputAsPlist {
  d.writeToFile("non-binary.plist", atomically:true)
} else {
  let json=NSJSONSerialization.dataWithJSONObject(d, options:.PrettyPrinted, error:nil)
  json?.writeToFile("non-binary.json", atomically:true)
}
ChristianCiach commented 5 years ago

This still happens with 3.0.0. Can I provide anything to help debugging this issue? My app-Bundle has been created by Platypus, so I don't have direct influence over the creation of the plist file.