zfkun / node-airplay

Apple AirPlay client library for node.js
MIT License
93 stars 45 forks source link

Module version mismatch. Expected 13, got 11. #3

Open SebCorbin opened 10 years ago

SebCorbin commented 10 years ago

Trying to use this library i've got this from file node_modules/airplay2/node_modules/mdns/lib/dns_sd.js

zfkun commented 10 years ago

Can you provide more description ?

SebCorbin commented 10 years ago

Sure, basically all I do is require('airplay2') but there seems to be a dependency problem with mdns.

When I do npm install airplay2, I get

npm WARN package.json Popcorn-Time@0.2.0 No repository field.
npm WARN package.json moviedb@0.1.1 No repository field.
npm WARN package.json socket.io@1.0.0 No repository field.
npm WARN package.json url@0.7.9 url is also the name of a node core module.
npm http GET https://registry.npmjs.org/airplay2
npm http 304 https://registry.npmjs.org/airplay2
npm http GET https://github.com/zfkun/node_mdns/tarball/master
npm http GET https://registry.npmjs.org/plist
npm http 304 https://registry.npmjs.org/plist
npm http 200 https://github.com/zfkun/node_mdns/tarball/master
npm WARN excluding symbolic link utils/ncov -> lib/ncov.js

> mdns@2.1.3 install /Users/sebcorbin/Sites/popcorn-app/node_modules/airplay2/node_modules/mdns
> node-gyp rebuild

  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_sd.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_browse.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_enumerate_domains.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_get_addr_info.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_process_result.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_ref.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_ref_deallocate.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_ref_sock_fd.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_register.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_service_resolve.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/mdns_utils.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/network_interface.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/socket_watcher.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/txt_record_ref.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/txt_record_create.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/txt_record_deallocate.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/txt_record_set_value.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/txt_record_get_length.o
  CXX(target) Release/obj.target/dns_sd_bindings/src/txt_record_buffer_to_object.o
  SOLINK_MODULE(target) Release/dns_sd_bindings.node
  SOLINK_MODULE(target) Release/dns_sd_bindings.node: Finished
npm http GET https://registry.npmjs.org/xmlbuilder
npm http GET https://registry.npmjs.org/xmldom
npm http 304 https://registry.npmjs.org/xmldom
npm http 304 https://registry.npmjs.org/xmlbuilder
airplay2@0.1.3 node_modules/airplay2
├── plist@0.4.3 (xmlbuilder@0.4.3, xmldom@0.1.19)
└── mdns@2.1.3`

Then in my app I get this error :

Uncaught node.js Error 

Error: dlopen(/Users/sebcorbin/Sites/popcorn-app/build/releases/Popcorn-Time/mac/Popcorn-Time.app/Contents/Resources/app.nw/node_modules/airplay2/node_modules/mdns/build/Release/dns_sd_bindings.node, 1): no suitable image found.  Did find:
/Users/sebcorbin/Sites/popcorn-app/build/releases/Popcorn-Time/mac/Popcorn-Time.app/Contents/Resources/app.nw/node_modules/airplay2/node_modules/mdns/build/Release/dns_sd_bindings.node: mach-o, but wrong architecture
    at Module.load (module.js:352:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:360:17)
    at require (module.js:376:17)
    at Object.eval (/Users/sebcorbin/Sites/popcorn-app/build/releases/Popcorn-Time/mac/Popcorn-Time.app/Contents/Resources/app.nw/node_modules/airplay2/node_modules/mdns/lib/dns_sd.js:24:20)
    at Module._compile (module.js:452:26)
    at Object.Module._extensions..js (module.js:470:10)
    at Module.load (module.js:352:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:360:17)

I read here https://groups.google.com/d/msg/node-webkit/cfHrfHJRzaM/mZ06QxY6MlAJ that it is an architecture problem so I do export npm_config_arch=ia32 and redo npm install airplay2 and relaunch the app and then I get

Uncaught node.js Error 

Error: Module version mismatch. Expected 13, got 11.
    at Module.load (module.js:352:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:360:17)
    at require (module.js:376:17)
    at Object.eval (/Users/sebcorbin/Sites/popcorn-app/build/releases/Popcorn-Time/mac/Popcorn-Time.app/Contents/Resources/app.nw/node_modules/airplay2/node_modules/mdns/lib/dns_sd.js:24:20)
    at Module._compile (module.js:452:26)
    at Object.Module._extensions..js (module.js:470:10)
    at Module.load (module.js:352:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:360:17)
zfkun commented 10 years ago

may be, your node or node-gyp version is old ?

on my mac:

SebCorbin commented 10 years ago

OK so I found the problem (but not the solution), airplay2 works in command line, but not under node-webkit. It seems that node-webkit runs 32bits, but airplay2/mdns is compiled in 64bits

zfkun commented 10 years ago

oh, i know ~

if you want use airplay2 in node-webkit, you must rebuild mdns module with nw-gyp.

cd node_modules/airplay2/node_modules/mdns && nw-gyp rebuild --target=0.8.6

example in package.json: https://github.com/zfkun/iplay/blob/master/package.json#L28

fwachs commented 10 years ago

That doesn't work for me for some reason. It still throws the same error. Any advice?

SebCorbin commented 10 years ago

Yep, I got it again