7
votes
The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false

Body: {"message":"Unable to resolve module events from /Users/mohitverma/Desktop/Projects/Android Apps/easyread/node_modules/node-metainspector/index.js: Module does not exist in the module map or in these directories:\n /Users/mohitverma/Desktop/Projects/Android Apps/easyread/node_modules/node-metainspector/node_modules\n, /Users/mohitverma/Desktop/Projects/Android Apps/easyread/node_modules\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache.","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]} onResponse DevServerHelper.java:323 execute RealCall.java:126 run NamedRunnable.java:32 runWorker ThreadPoolExecutor.java:1112 run ThreadPoolExecutor.java:587 run Thread.java:818

import React, {Component} from 'react';
import {AppRegistry, StyleSheet, Text, View, Alert} from 'react-  native';
var Extractor = require('node-metainspector');
import axios from 'axios';

const msgTitle = 'Server error';
const msgDescription = 'Could not get data from website';

 export default class Web extends Component {

 constructor(props) {
    super(props);
    this.state = {
        siteDetail: {}
    };
}

componentDidMount() {
    axios(this.props.url).then((webResponse) => {
        //const siteDetail = Extractor(webResponse);
        //this.setState({siteDetail});
        Alert.alert(msgTitle, webResponse.toString());
    }).catch((err) => {
        Alert.alert(msgTitle, msgDescription);
    });
}

render() {
    const self = this;

    return (
        <View style={styles.container}>
            <Text style={styles.welcome}>
                {self.state.siteDetail.title}
            </Text>
        </View>
    );
 }
}
1
show your node.js codeMax Koretskyi
few external libraries not getting resolved in react-nativeMohit Verma

1 Answers

18
votes

I had the same issue and found a similar github issue.

Following the advice, I had installed the dependency with: npm install events --save and this has resolved my issue.