2016-03-01 129 views
0

我正在嘗試關注官方react-native tutorial。一切都很好,直到我嘗試運行該項目。然後bash腳本與以下錯誤消息無法在模擬器中啓動反應原生應用程序

~/react_sites/AwesomeProject/node_modules/react-native/packager ~ 

/Users/Chris/react_sites/AwesomeProject/node_modules/react-native/local-cli/cli.js:74 
    const setupEnvScript = /^win/.test(process.platform) 
    ^^^^^ 
SyntaxError: Use of const in strict mode. 
    at Module._compile (module.js:439:25) 
    at Object.Module._extensions..js (module.js:474:10) 
    at Module.load (module.js:356:32) 
    at Function.Module._load (module.js:312:12) 
    at Function.Module.runMain (module.js:497:10) 
    at startup (node.js:119:16) 
    at node.js:902:3 
~ 
Process terminated. Press <enter> to close the window 

彈出並模擬器給出了Could not connect to development server錯誤。我該如何解決?

我正在使用Xcode 7.2。

回答

1

我會假設你有pre-requisites,但在移動之前仔細檢查。 Homebrew,Watchman,Node 4+和Flow(可選)。

當您在Xcode中打開項目並按下構建按鈕(play?)時,它應該自動啓動包裝器服務器。但在你的情況下,似乎沒有。在這種情況下,請在構建項目之前在項目的根目錄中嘗試在終端中運行npm start

相關問題