question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native import not found

See original GitHub issue

I 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 map

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 Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. 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:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
MakhouTcommented, Jun 7, 2019

@markwolff Sorry for getting back late to you. Other stuff got in the way! I’ll retry it this weekend and will provide feedback!

1reaction
markwolffcommented, Jun 6, 2019

Fixed in 1.0.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is importing not working in react native? - Stack Overflow
4 Answers 4 · Double check if file exist at given path or not · If file is not javascript(.js), then mention the...
Read more >
Module not found: Can't resolve 'X' error in React | bobbyhadz
To solve the "Module not found: Can't resolve" error in React, make sure to install the package from the error message if it's...
Read more >
Troubleshooting - React Native
If you encounter something that is not listed here, try searching for ... Xcode should look for #import header files specified in the...
Read more >
Troubleshooting common React Native bugs - LogRocket Blog
This troubleshooting guide shares how to easily find and address common React Native bugs. See common error examples.
Read more >
export 'default' (imported as) was not found in ... - YouTube
Solve this error in your React or React Native project. Professional JavaScript Course: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found