如何在Windows上运行React Native官方示例的打包程序?

时间:2016-04-05 23:18:16

标签: android windows reactjs react-native

按照本指南https://github.com/facebook/react-native#examples 克隆官方回购并成功运行后

  

gradlew:示例:UIExplorer:android:app:installDebug

指南的下一步是

  

在单独的shell中启动打包程序(确保运行npm install):   ./packager/packager.sh

不幸的是我无法在Windows上运行shell脚本。我该怎么办?

在尝试@ whitep4nther的建议后,运行node "./local-cli/cli.js" start会出现以下错误


Looking for JS files in
   D:\dev\sources\react-native

 ERROR  FileWatcher is not a function
TypeError: FileWatcher is not a function
    at new Server (index.js:189:9)
    at Object.createServer (D:\dev\sources\react-native\packager\react-packager\index.js:107:10)
    at getPackagerServer (runServer.js:74:24)
    at runServer (runServer.js:29:26)
    at startServer (server.js:148:3)
    at _server (server.js:144:3)
    at server.js:24:5
    at tryCallTwo (D:\dev\sources\react-native\node_modules\promise\lib\core.js:45:5)
    at doResolve (D:\dev\sources\react-native\node_modules\promise\lib\core.js:200:13)
    at new Promise (D:\dev\sources\react-native\node_modules\promise\lib\core.js:66:3) 

运行节点5.10.0 npm 3.8.3 Windows 10 x64 任何建议将不胜感激

1 个答案:

答案 0 :(得分:1)

在Windows上,您只能开发Android应用程序。

您可以完全按照this page开始 - 每次都有Windows环境的步骤。

react-native/中运行npm install后,运行 node "./local-cli/cli.js" start