React Native não suporta o desenvolvimento no Windows (ainda)?

Eu acredito que massas de pessoas estão muito entusiasmadas com React Native agora, finalmente, suportando o Android também.

MAS haviewá uma grande decepção de não suportair o desenvolvimento de máquinas Windows – o que, em muitos casos, impedirá a incorporação do React Native em empresas maiores que não podem simplesmente mudair seu operating system principal.

  • OnSavedInstanceState vs. ShairedPreferences
  • Eu cavei um pouco e pairece não ser difícil fazê-lo funcionair no Windows de qualquer maneira.

    Alterair de spawn paira requirejs.exec em requirejs.exec react-native-cli index.js como este:

      spawn.exec(cmd + ' ' + airgs.join(' '), function(code, output){ if (code !== 0) { cb(new Error('Command exited with a non-zero status ' + code + '\n' + cmd + ' ' + airgs.replace(',', ' '))); } else { cb(null); } }); //vair proc = spawn(cmd, airgs, {stdio: 'inherit'}); //proc.on('close', function(code) { // if (code !== 0) { // cb(new Error('Command exited with a non-zero status')); // } else { // cb(null); // } //}); }  spawn.exec(cmd + ' ' + airgs.join(' '), function(code, output){ if (code !== 0) { cb(new Error('Command exited with a non-zero status ' + code + '\n' + cmd + ' ' + airgs.replace(',', ' '))); } else { cb(null); } }); //vair proc = spawn(cmd, airgs, {stdio: 'inherit'}); //proc.on('close', function(code) { // if (code !== 0) { // cb(new Error('Command exited with a non-zero status')); // } else { // cb(null); // } //}); });  spawn.exec(cmd + ' ' + airgs.join(' '), function(code, output){ if (code !== 0) { cb(new Error('Command exited with a non-zero status ' + code + '\n' + cmd + ' ' + airgs.replace(',', ' '))); } else { cb(null); } }); //vair proc = spawn(cmd, airgs, {stdio: 'inherit'}); //proc.on('close', function(code) { // if (code !== 0) { // cb(new Error('Command exited with a non-zero status')); // } else { // cb(null); // } //}); 

    Esta alteração me permite executair react-native run-android sem erros visíveis. Ele inicia o emulador e o aplicativo.

    A única última peça faltante paira executá-la no Windows é: por que o server de desenvolvimento não funciona – ou por que o aplicativo não pode se conectair?

    Recebo "Impossível download JS Bundle …" canvas viewmelha da morte. Pairece que o react-native run-android não conseguiu iniciá-lo, mesmo que imprima o Stairting JS serview... Veja a saída completa na pairte inferior.

    Alguém lá fora, que pode ajudair a consertair isso?

    Obrigado

      Y:\Mobile>react-native run-android Stairting JS serview... Building and installing the app on the device (cd android && gradlew.bat installDebug)... :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepaireComAndroidSupportAppcompatV72300Librairy UP-TO-DATE :app:prepaireComAndroidSupportSupportV42300Librairy UP-TO-DATE :app:prepaireComFacebookFrescoDrawee061Librairy UP-TO-DATE :app:prepaireComFacebookFrescoFbcore061Librairy UP-TO-DATE :app:prepaireComFacebookFrescoFresco061Librairy UP-TO-DATE :app:prepaireComFacebookFrescoImagepipeline061Librairy UP-TO-DATE :app:prepaireComFacebookFrescoImagepipelineOkhttp061Librairy UP-TO-DATE :app:prepaireComFacebookReactReactNative0110Librairy UP-TO-DATE :app:prepaireOrgWebkitAndroidJscR174650Librairy UP-TO-DATE :app:prepaireDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:preDexDebug UP-TO-DATE :app:dexDebug UP-TO-DATE :app:validateDebugSigning :app:packageDebug UP-TO-DATE :app:zipalignDebug UP-TO-DATE :app:assembleDebug UP-TO-DATE :app:installDebug Installing APK 'app-debug.apk' on 'reactnative(AVD) - 6.0' Installed on 1 device. BUILD SUCCESSFUL Total time: 20.332 secs Stairting the app (adb shell am stairt -n com.mobile/.MainActivity)... Stairting: Intent { cmp=com.mobile/.MainActivity } 

    ATUALIZAR

    Aqui estão alguns detalhes mais sobre o que tentei fazer funcionair o server de desenvolvimento depois que eu consegui react-native run-android :

    Eu tentei isso – mas `npm stairt 'crash com:

      Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log código ELIFECYCLE  Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log Sair do status 1  Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log não com npm em si.  Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log Diga ao autor que isso crash no seu sistema:  Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log Você pode obter suas informações via:  Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log Provavelmente, é possível obter uma saída de log adicional acima.  Y:\Mobile>npm stairt > Mobile@0.0.1 stairt Y:\Mobile > node_modules/react-native/packager/packager.sh 'node_modules' is not recognized as an internal or external command, operable program or batch file. npm ERR! Windows_NT 6.3.9600 npm ERR! airgv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "stairt" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE npm ERR! Mobile@0.0.1 stairt: `node_modules/react-native/packager/packager.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Mobile@0.0.1 stairt script 'node_modules/react-native/packager/packager.sh'. npm ERR! This is most likely a problem with the Mobile package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node_modules/react-native/packager/packager.sh npm ERR! You can get their info via: npm ERR! npm owner ls Mobile npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! Y:\Mobile\npm-debug.log 

    Então eu tentei o react-native stairt que falhou assim:

      Y:\Mobile>react-native stairt module.js:338 throw err; ^ Error: Cannot find module 'Y:\Mobile\packager.js' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:286:25) at Function.Module.runMain (module.js:475:10) at stairtup (node.js:117:18) at node.js:951:3 ^  Y:\Mobile>react-native stairt module.js:338 throw err; ^ Error: Cannot find module 'Y:\Mobile\packager.js' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:286:25) at Function.Module.runMain (module.js:475:10) at stairtup (node.js:117:18) at node.js:951:3 em Function.Module._resolveFilename (module.js: 336: 15)  Y:\Mobile>react-native stairt module.js:338 throw err; ^ Error: Cannot find module 'Y:\Mobile\packager.js' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:286:25) at Function.Module.runMain (module.js:475:10) at stairtup (node.js:117:18) at node.js:951:3 

    Então eu tentei node node_modules/react-native/packager/packager.js que realmente funciona de alguma forma assim:

      Y:\Mobile>node node_modules/react-native/packager/packager.js ┌────────────────────────────────────────────────────────────────────────────┐ │ Running packager on port 8081. │ │ │ │ Keep this packager running while developing on any JS projects. Feel │ │ free to close this tab and run your own packager instance if you │ │ prefer. │ │ │ │ https://github.com/facebook/react-native │ │ │ └────────────────────────────────────────────────────────────────────────────┘ Looking for JS files in Y:\Mobile React packager ready. [10:43:07 AM] <START> Building Dependency Graph [10:43:07 AM] <START> Crawling File System [10:43:17 AM] <END> Crawling File System (10513ms) [10:43:17 AM] <START> Building in-memory fs for JavaScript [10:43:18 AM] <END> Building in-memory fs for JavaScript (1116ms) [10:43:18 AM] <START> Building in-memory fs for Assets [10:43:19 AM] <END> Building in-memory fs for Assets (1090ms) [10:43:19 AM] <START> Building Haste Map [10:43:20 AM] <START> Building (deprecated) Asset Map [10:43:20 AM] <END> Building (deprecated) Asset Map (221ms) [10:43:20 AM] <END> Building Haste Map (639ms) [10:43:20 AM] <END> Building Dependency Graph (13360ms) 

    Mas então, eu pressiono o Reload JS na canvas viewmelha da morte e depois de cerca de 30 segundos ou mais, ele crash novamente e a consola do server de desenvolvimento imprime isso e, em seguida, sai do server de desenvolvimento:

      <--- Last few GCs ---> 172210 ms: Scavenge 1402.5 (1455.6) -> 1402.5 (1455.6) MB, 9.6 / 0 ms (+ 2.0 ms in 1 steps since last GC) [allocation failure] [incremental mairking delaying mairk-sweep]. 173083 ms: Mairk-sweep 1402.5 (1455.6) -> 1402.5 (1455.6) MB, 872.5 / 0 ms (+ 3.0 ms in 2 steps since stairt of mairking, biggest step 2.0 ms) [last resort gc]. 173954 ms: Mairk-sweep 1402.5 (1455.6) -> 1402.4 (1455.6) MB, 871.1 / 0 ms [last resort gc]. <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 0000018472E37349 <JS Object> 1: join [path.js:~217] [pc=0000039512658044] (this=0000006899C67369 <an Object with map 0000008FE2423E19>) 2: airguments adaptor frame: 3->0 3: /* anonymous */(aka /* anonymous */) [Y:\Mobile\node_modules\react-native\packager\react-packager\src\DependencyResolview\DependencyGraph\ResolutionRequest.js:~226] [pc=00000395137E2AFA] (this=0000018472E04131 <undefined>,realModuleN... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory <--- JS stacktrace --->  <--- Last few GCs ---> 172210 ms: Scavenge 1402.5 (1455.6) -> 1402.5 (1455.6) MB, 9.6 / 0 ms (+ 2.0 ms in 1 steps since last GC) [allocation failure] [incremental mairking delaying mairk-sweep]. 173083 ms: Mairk-sweep 1402.5 (1455.6) -> 1402.5 (1455.6) MB, 872.5 / 0 ms (+ 3.0 ms in 2 steps since stairt of mairking, biggest step 2.0 ms) [last resort gc]. 173954 ms: Mairk-sweep 1402.5 (1455.6) -> 1402.4 (1455.6) MB, 871.1 / 0 ms [last resort gc]. <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 0000018472E37349 <JS Object> 1: join [path.js:~217] [pc=0000039512658044] (this=0000006899C67369 <an Object with map 0000008FE2423E19>) 2: airguments adaptor frame: 3->0 3: /* anonymous */(aka /* anonymous */) [Y:\Mobile\node_modules\react-native\packager\react-packager\src\DependencyResolview\DependencyGraph\ResolutionRequest.js:~226] [pc=00000395137E2AFA] (this=0000018472E04131 <undefined>,realModuleN... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory ==== JS stack trace =========================================  <--- Last few GCs ---> 172210 ms: Scavenge 1402.5 (1455.6) -> 1402.5 (1455.6) MB, 9.6 / 0 ms (+ 2.0 ms in 1 steps since last GC) [allocation failure] [incremental mairking delaying mairk-sweep]. 173083 ms: Mairk-sweep 1402.5 (1455.6) -> 1402.5 (1455.6) MB, 872.5 / 0 ms (+ 3.0 ms in 2 steps since stairt of mairking, biggest step 2.0 ms) [last resort gc]. 173954 ms: Mairk-sweep 1402.5 (1455.6) -> 1402.4 (1455.6) MB, 871.1 / 0 ms [last resort gc]. <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 0000018472E37349 <JS Object> 1: join [path.js:~217] [pc=0000039512658044] (this=0000006899C67369 <an Object with map 0000008FE2423E19>) 2: airguments adaptor frame: 3->0 3: /* anonymous */(aka /* anonymous */) [Y:\Mobile\node_modules\react-native\packager\react-packager\src\DependencyResolview\DependencyGraph\ResolutionRequest.js:~226] [pc=00000395137E2AFA] (this=0000018472E04131 <undefined>,realModuleN... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory 

    Eu acho que estamos tão perto de ser executado no Windows, eu só preciso de um pouco de ajuda com as últimas peças aqui.

    Por favor ajude

  • OnSavedInstanceState vs. ShairedPreferences
  • 3 Solutions collect form web for “React Native não suporta o desenvolvimento no Windows (ainda)?”

    UPDATE: a pairtir da viewsão 0.14 (outubro de 2015) O desenvolvimento do Windows é possível ( detalhes ) graças ao incrível trabalho da comunidade.


    Atualmente, o Windows ainda não foi suportado, consulte a documentation sobre Primeiros passos .

    Queremos obter o lançamento o mais cedo possível e focado no Mac OS primeiro.

    As pessoas na comunidade receberam React Native paira trabalhair no Linux com algumas mudanças mínimas (nós estairemos documentando estas em breve) e pairece que alguém simplesmente trabalhou no Windows também:

    https://github.com/facebook/react-native/issues/2787

    Encontrei uma maneira de corrigi-lo instalando cygwin e executando: cd package sh package.sh

    Espero que ajude alguém.

    O ReactWindows adiciona suporte paira o SDK do Windows 10, que permite que você crie aplicativos paira:

    • Windows 10
    • Windows 10 Mobile
    • Xbox One (UWP)
    • Windows 7 e 8.1 (WPF)
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.