React Native iOS Deployment Error

2019-09-11 04:03发布

问题:

The below error occurred while in attempt to deploy my app to the mobile phone for testing.

the app function in the Xcode Simulator, and was able to export to the app into iPhone for testing.

after running the npm start the following error occurred.

while the iPhone app did load but count not connect to development server due to not able to npm start.

And yes both the iPhone and my computer is on the same wireless network.

 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  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
   /Users/jimmylin/dev/ga/WalkingTour/SohoDuck 

[10:40:02 AM] <START> Building Dependency Graph
[10:40:02 AM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot

React packager ready.

ERROR: Unknown option --no-pretty

ERROR: Unknown option --no-pretty

Watchman:  watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty

 ERROR  watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty

Error: watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty

    at ChildProcess.<anonymous> (/Users/jimmylin/dev/ga/WalkingTour/SohoDuck/node_modules/fb-watchman/index.js:198:18)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at Pipe._onclose (net.js:477:12)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.

npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/Cellar/node/5.9.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.9.1
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! SohoDuck@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the SohoDuck@0.0.1 start script 'node node_modules/react-native/local-cli/cli.js start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the SohoDuck package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/react-native/local-cli/cli.js start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs SohoDuck
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls SohoDuck
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jimmylin/dev/ga/WalkingTour/SohoDuck/npm-debug.log

any suggestion would be greatly appreciated.

回答1:

Correct installation of dependencies

  1. Uninstall watchman and flow via npm and homebrew
  2. Install watchman and flow only via homebrew

    brew install watchman
    brew install flow