PeelTechnologies / react-native-tcp

node's net api in react-native
MIT License
284 stars 213 forks source link

Is there a fix for the Unhandled promise error, in TcpSockets.js . Can someone help me with this? #104

Open SuryaChandrasekaran opened 5 years ago

SuryaChandrasekaran commented 5 years ago

node_modules\react-native-tcp\TcpSockets.js:16 exports.createServer = function(connectionListener : (socket: Socket) => void) : Server { ^

SyntaxError: Unexpected token : at new Script (vm.js:80:7) at createScript (vm.js:274:10) at Object.runInThisContext (vm.js:326:10) at Module._compile (internal/modules/cjs/loader.js:664:28) at Module._compile (C:\react workspace\twilioSMS\node_modules\pirates\lib\index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Object.newLoader [as .js] (C:\react workspace\twilioSMS\node_modules\pirates\lib\index.js:104:7) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) (node:6012) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:6012) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

braksator commented 5 years ago

I had the same problem. It seems those .js files in this project are written in typescript. I installed a module that lets react-native comprehend typescript automatically and that seems to have sorted it out. https://github.com/ds300/react-native-typescript-transformer

phillbaker commented 5 years ago

A maintained fork is over at https://github.com/aprock/react-native-tcp (I help to maintain it).

I'd like to help get this sorted out - we use this package as a dependency, and don't use typescript. It seems like this should be a pretty common problem, I'm confused how it doesn't pop up more.

SuryaChandrasekaran commented 5 years ago

Thanks