I'm new to React-Native and use the Expo xde GUI. I had no problems up to the point, I wanted to use external modules at. I installed them using npm install module. Next I wanted to import them into my App.js file using import Module from 'module' But after starting the project I got the following error in the Expo Client App on the iOS Simulator:
Unable to resolve module
react-renderiffrom/Users/my_name/Desktop/ExpoProjekte/test/App.js: Module does not exist in the module map or in these directories:
/Users/my_name/node-modulesThis 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 thenode_modulesfolder:rm -rf node_modules && npm install. 3. Reset Metro Bundler cache:rm -rf $TMPDIR/react-*ornpm start -- --reset-cache. 4. Remove haste cache:rm -rf $TMPDIR/haste-map-react-native-packager-*.ABI25_0_0RCTFatal 37-[ABI25_0_0RCTCxxBridge handleError:]_block_invoke _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 0x0
I tried all tipps mentioned in the error message, but nothing helped. I also tried out many workarounds described on the internet (e.g. in this forum), but this also didn't lead to success. The problem occurs with all modules that I tried to install and to import, e.g. react-renderif and native-base.
Do you have any ideas how to solve this problem? I know that the question was asked several times in this forum, but the answers didn't help me, maybe because they only worked for older versions.
Regards,
Paul
Desktop operating system: MacOS Sierra (10.12.6)
Expo version: 2.22.1
npm version: 4.6.1 and 5.6.0 (I tried out both)
My package.json:
{
"name": "my_name",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"native-base": "^2.3.10"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}