react-web的例子运行出错

rayliao
  • 3.1k

react-web里面的movies的例子,web运行没问题,但在xcode运行的时候报错了。报Unable to resolve module ReactJsonp 的错误。似乎ReactJsonpReactFetch这两个模块都加载不到。

var fetch = Platform.OS === 'web'? require('ReactJsonp'): require('ReactFetch');

我贴出报错的代码:

+ DEST=/Users/LiaoYingRay/Library/Developer/Xcode/DerivedData/RNmovies-floigkrygboxgoayhhrfadmwqzsd/Build/Products/Debug-iphonesimulator/RNmovies.app


+ '[' -z '' ']'


+ export NVM_DIR=/Users/LiaoYingRay/.nvm


+ NVM_DIR=/Users/LiaoYingRay/.nvm


+ [[ -s /Users/LiaoYingRay/.nvm/nvm.sh ]]


++ command -v brew


+ [[ -x /usr/local/bin/brew ]]


++ brew --prefix nvm


+ [[ -s /usr/local/Cellar/nvm/0.29.0/nvm.sh ]]


+ react-native bundle --entry-file index.ios.js --platform ios --dev true --bundle-output /Users/LiaoYingRay/Library/Developer/Xcode/DerivedData/RNmovies-floigkrygboxgoayhhrfadmwqzsd/Build/Products/Debug-iphonesimulator/RNmovies.app/main.jsbundle --assets-dest /Users/LiaoYingRay/Library/Developer/Xcode/DerivedData/RNmovies-floigkrygboxgoayhhrfadmwqzsd/Build/Products/Debug-iphonesimulator/RNmovies.app


bundle: Created ReactPackager


uncaught error Error: UnableToResolveError: Unable to resolve module ReactJsonp from /Users/LiaoYingRay/Projects/github/demo/RNmovies/SearchScreen.js: Invalid directory /Users/node_modules/ReactJsonp


    at ResolutionRequest.js:351:15


    at tryCallOne (/Users/LiaoYingRay/Projects/github/demo/RNmovies/node_modules/react-native/node_modules/promise/lib/core.js:37:12)


    at /Users/LiaoYingRay/Projects/github/demo/RNmovies/node_modules/react-native/node_modules/promise/lib/core.js:123:15


    at flush (/Users/LiaoYingRay/Projects/github/demo/RNmovies/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)


    at doNTCallback0 (node.js:417:9)


    at process._tickCallback (node.js:346:13)


See logs /var/folders/53/s7vfpx994bq379dcvh2j96r00000gn/T/react-packager.log


    at SocketClient._handleMessage (SocketClient.js:139:23)


    at BunserBuf.<anonymous> (SocketClient.js:53:42)


    at emitOne (events.js:77:13)


    at BunserBuf.emit (events.js:169:7)


    at BunserBuf.process (/Users/LiaoYingRay/Projects/github/demo/RNmovies/node_modules/react-native/node_modules/bser/index.js:289:10)


    at /Users/LiaoYingRay/Projects/github/demo/RNmovies/node_modules/react-native/node_modules/bser/index.js:244:12


    at doNTCallback0 (node.js:417:9)


    at process._tickCallback (node.js:346:13)


Command /bin/sh failed with exit code 1
回复
阅读 3.3k
2 个回答

找不到就手动install一下试试

宣传栏