airbrake-js: React Native - Unable to resolve 'os'
Using this guide from the documentation.
Import it like this
import { Component } from 'react'
import AirbrakeClient from 'airbrake-js'
export default class ErrorBoundary extends Component {
constructor(props) {
super(props)
this.airbrake = new AirbrakeClient({
projectId: 1,
projectKey: 'excluded_for_example'
})
}
componentDidCatch(error, info) {
this.airbrake.notify({
error: error,
params: { info: info }
})
}
render() {
return this.props.children
}
}
then wrapped my RootComponent
in ErrorBoundary
like this
<ErrorBoundary>
<RootContainer />
</ErrorBoundary>
I get the following error on both Android and iOS
error: bundling failed: Error: Unable to resolve module `os` from `/Users/{...}/node_modules/airbrake-js/dist/client.js`: Module `os` 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-*`.
at ModuleResolver.resolveDependency (/Users/{...}/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:167:1306)
at ResolutionRequest.resolveDependency (/Users/{...}/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:80:16)
at DependencyGraph.resolveDependency (/Users/{...}/node_modules/metro/src/node-haste/DependencyGraph.js:237:485)
at Object.resolve (/Users/{...}/node_modules/metro/src/lib/transformHelpers.js:116:25)
at dependencies.map.result (/Users/{...}/node_modules/metro/src/DeltaBundler/traverseDependencies.js:298:29)
at Array.map (<anonymous>)
at resolveDependencies (/Users/{...}/node_modules/metro/src/DeltaBundler/traverseDependencies.js:294:16)
at /Users/{...}/node_modules/metro/src/DeltaBundler/traverseDependencies.js:159:33
at Generator.next (<anonymous>)
at step (/Users/{...}/node_modules/metro/src/DeltaBundler/traverseDependencies.js:239:307)
airbrake-js - 1.5.0
Any ideas?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 15 (6 by maintainers)
This issue is still existing even with the latest 1.6.5 version. I can confirm that the 1.2.0 version works fine.
Are you going to fix this issue for upcoming versions?