React Native import not found
See original GitHub issueI am importing like so import { ReactNativePlugin } from '@microsoft/applicationinsights-react-native';
But the application (and ESLint) is complaining that it can’t find that module.
Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module
@microsoft/applicationinsights-web
from/Users/makhout/Documents/Projects/my_project/src/router/Routes.js
: Module@microsoft/applicationinsights-web
does not exist in the Haste module mapThis might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following:
- Clear watchman watches:
watchman watch-del-all
.- Delete the
node_modules
folder:rm -rf node_modules && npm install
.- Reset Metro Bundler cache:
rm -rf /tmp/metro-bundler-cache-*
ornpm start -- --reset-cache
.- Remove haste cache:
rm -rf /tmp/haste-map-react-native-packager-*
. (null))__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.213 RCTCxxBridge.mm:414 ___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118 __80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke -[RCTMultipartStreamReader emitChunk:headers:callback:done:] -[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:] -[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:] __88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK -[NSBlockOperation main] -[__NSOperationInternal _start:] __NSOQSchedule_f _dispatch_call_block_and_release _dispatch_client_callout _dispatch_continuation_pop _dispatch_async_redirect_invoke _dispatch_root_queue_drain _dispatch_worker_thread2 _pthread_wqthread start_wqthread
I am having the issues both on android and iOS. I am on React Native version 0.59.8.
Dependencies in package.json to make this run
"dependencies": {
"@microsoft/applicationinsights-react-native": "1.0.0",
"@microsoft/applicationinsights-web": "2.0.0",
"react-native-device-info": "2.0.2"
}
Deleted node_modules, tried clearing cache of yarn and watch man. Only deleting the metro bundler cache and haste cache was not successful as there wasn’t a temp folder.
Code snippet:
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
import { ReactNativePlugin } from '@microsoft/applicationinsights-react-native';
const RNPlugin = new ReactNativePlugin();
const appInsights = new ApplicationInsights({
config: {
instrumentationKey: 'XXX-XXX-XXX-XXX',
},
extensions: [RNPlugin],
});
appInsights.loadAppInsights();
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top GitHub Comments
@markwolff Sorry for getting back late to you. Other stuff got in the way! I’ll retry it this weekend and will provide feedback!
Fixed in 1.0.2