From df687d84427b602aac43e90c1b74711673f6e627 Mon Sep 17 00:00:00 2001 From: Bram Date: Fri, 27 Nov 2015 07:15:28 -0800 Subject: [PATCH] bugfix #3997: react-native bundle not working on windows 10 Summary: fixes https://github.com/facebook/react-native/issues/3997 the root cause is in Mon, 09 Nov 2015 13:22:47 GMT ReactNativePackager:SocketServer uncaught error Error: listen EACCES C:\Users\donald\AppData\Local\Temp\react-packager-9248a9803ac72b509b389b456696850d This means that the socket server cannot create the socket. cfr https://gist.github.com/domenic/2790533 the socket name is not a valid windows socket name. Closes https://github.com/facebook/react-native/pull/4071 Reviewed By: mkonicek Differential Revision: D2699546 Pulled By: davidaurelio fb-gh-sync-id: 6c6494c14c42bb17506b8559001419c9f85e91e3 --- react-packager/src/SocketInterface/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/react-packager/src/SocketInterface/index.js b/react-packager/src/SocketInterface/index.js index c56026ea..32e3688c 100644 --- a/react-packager/src/SocketInterface/index.js +++ b/react-packager/src/SocketInterface/index.js @@ -35,10 +35,17 @@ const SocketInterface = { } }); - const sockPath = path.join( + let sockPath = path.join( tmpdir, 'react-packager-' + hash.digest('hex') ); + if (process.platform === 'win32'){ + // on Windows, use a named pipe, convert sockPath into a valid pipe name + // based on https://gist.github.com/domenic/2790533 + sockPath = sockPath.replace(/^\//, '') + sockPath = sockPath.replace(/\//g, '-') + sockPath = '\\\\.\\pipe\\' + sockPath + } if (fs.existsSync(sockPath)) { var sock = net.connect(sockPath);