balthazar / react-native-zeroconf

:satellite: Discover Zeroconf services using react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Version does not work

FrankFundel opened this issue · comments

When updating to 0.12.0 with npm, I get an error saying, that I called publishService with 5 arguments but expected 6. In fact the /dist/index.js was not updated:
key:'publishService',value:function publishService(type,protocol){var domain=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'local.';var name=arguments[3];var port=arguments[4];RNZeroconf.registerService(type,protocol,domain,name,port);}}

The txt argument is missing.

And txt (tested on iOS) can only handle string, not boolean or int etc.

When updating to 0.12.0 with npm, I get an error saying, that I called publishService with 5 arguments but expected 6. In fact the /dist/index.js was not updated:
key:'publishService',value:function publishService(type,protocol){var domain=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'local.';var name=arguments[3];var port=arguments[4];RNZeroconf.registerService(type,protocol,domain,name,port);}}

The txt argument is missing.

I noticed that too, but I figured that it was just my own cache that was somehow corrupt.

In package.json you see this step:

"build": "rm -rf dist && mkdir dist && babel src -o dist/index.js"

which is meant to generate the index.js in question. But when I look at the contents of my node_modules/react-native-zeroconf I do see dist and the function, just as you've shared above @FrankFundel without the txt argument!

My understanding is that the build command is meant to execute and create this dist/index.js. I think that this is still happening, but it is creating the old version of publishService with the wrong arity.

Have you tried removing your cache?

I tried this:

watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* &&  rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean --force &&  npm install && npm start -- --reset-cache

and I can still see this error that you're describing @FrankFundel

@balthazar what could be the reason for the generation of the old arity of publishService?

Mind you, if I run this manually with my version of the repo:

rm -rf dist && mkdir dist && babel src -o dist/index.js

and copy over the generated index.js to the expected place under node_modules, then I don't get this error described in this issue.

I can confirm that I'm definitely installing the latest version 0.12.0 just like @FrankFundel.

And txt (tested on iOS) can only handle string, not boolean or int etc.

Please pull in this change and test it out:

dotemacs@0776690

I just tried it on iOS & Android, it works. But it would be good to have a confirmation.

Try the new 0.12.1 version