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
This commit is contained in:
parent
01a0facf33
commit
710b443af1
|
@ -8,11 +8,11 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
const execFile = require('child_process').execFile;
|
||||
const fs = require('fs');
|
||||
const getAssetDestPathAndroid = require('./getAssetDestPathAndroid');
|
||||
const getAssetDestPathIOS = require('./getAssetDestPathIOS');
|
||||
const log = require('../util/log').out('bundle');
|
||||
const mkdirp = require('mkdirp');
|
||||
const path = require('path');
|
||||
|
||||
function saveAssets(
|
||||
|
@ -70,7 +70,7 @@ function copyAll(filesToCopy) {
|
|||
|
||||
function copy(src, dest, callback) {
|
||||
const destDir = path.dirname(dest);
|
||||
execFile('mkdir', ['-p', destDir], err => {
|
||||
mkdirp(destDir, err => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
"joi": "^6.6.1",
|
||||
"json5": "^0.4.0",
|
||||
"jstransform": "^11.0.3",
|
||||
"mkdirp": "^0.5.0",
|
||||
"module-deps": "^3.9.1",
|
||||
"node-fetch": "^1.3.3",
|
||||
"opn": "^3.0.2",
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue