Reputation: 2961
I got sources for an ios app dropped (from end 2016) in my lap, and am now trying to build and run it in the simulator. I am just learning React Native.
Full error message is here:
Unable to resolve module prop-types from /Users/raarts/work/MobileApp/app/node_modules/react-redux/lib/components/Provider.js: Module does not exist in the module map or in these directories:
/Users/raarts/work/MobileApp/app/node_modules/react-redux/node_modules
, /Users/raarts/work/MobileApp/app/node_modules
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`.
RCTFatal
-[RCTBatchedBridge stopLoadingWithError:]
__25-[RCTBatchedBridge start]_block_invoke_2
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start
Of course I did try the suggested solution, but that didn't work. My problem is: I inspected Provider.js, but the word 'prop-types' does not even occur in that file.
Here's the package.json:
{
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "./node_modules/.bin/eslint index*.js src __tests__",
"test": "jest"
},
"dependencies": {
"google-libphonenumber": "^2.0.10",
"prop-types": "^15.5.10",
"react": "15.4.2",
"react-native": "0.40.0",
"react-native-contacts": "^0.7.1",
"react-native-debug-stylesheet": "^0.1.1",
"react-native-device-info": "^0.9.7",
"react-native-i18n": "^0.1.1",
"react-native-keyboard-aware-scroll-view": "^0.2.8",
"react-native-modalbox": "^1.3.9",
"react-native-router-flux": "^3.36.0",
"react-native-scrollable-tab-view": "^0.7.0",
"react-native-send-intent": "^1.0.13",
"react-redux": "^4.4.5",
"redux": "^3.6.0",
"redux-actions": "^0.12.0",
"redux-thunk": "^2.1.0"
},
"jest": {
"preset": "react-native"
},
"devDependencies": {
"babel-eslint": "^7.0.0",
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"chai": "^3.5.0",
"eslint": "^3.12.1",
"eslint-plugin-react": "^6.4.1",
"eslint-plugin-react-native": "^2.2.1",
"fetch-mock": "^5.6.0",
"jest": "18.1.0",
"jest-react-native": "16.0.0",
"react-test-renderer": "15.4.2",
"redux-mock-store": "^1.2.1"
}
}
I googled around, and it seems prop-types was split off into a separate package as a replacement for PropTypes which became deprecated with React 15.5. So my initial guess was that some dependent package was using prop-types
. But imagine my surprise when I grepped the entire node_modules tree for 'prop-types' and it wasn't mentioned anywhere (accept in the changelog for eslint-plugin-react).
So now I'm baffled. What is happening here?
Upvotes: 5
Views: 21011
Reputation: 1697
you need prop-types module.
npm install --save prop-types
Upvotes: 10
Reputation: 2961
This answered my question: How do I fix RN suddenly being unable to find local modules (Unable to resolve module)?
Turns out the advice given in the error actually was correct, but I missed an error message.
Upvotes: 0