Thursday, 11 May 2017

React Native: Unable to Resolve Module

I have a very simple React Native project that I am trying to get working. It is an iOS project that simply adds a RCTRootView to a UIViewController. When I hit the url from a web browser I get:

Unable to resolve module `/src/components/HelloReact` from `/Users/myusername/Desktop/DemoReact/index.ios.js`: Directory /src/components/HelloReact doesn't exist.

index.ios.js

'use strict';

import { AppRegistry } from 'react-native';
import HelloReact from '/src/components/HelloReact';

AppRegistry.registerComponent('HelloReact', () => HelloReact);

HelloReact.js

import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';

export default class HelloReact extends Component {
  render() {
    return (
      <Text style=>
        I am bold
        <Text style=>
          and red
        </Text>
      </Text>
    )
  }
}

I am at a loss on how to resolve this. I have tried all of the following:

  • npm start
  • npm start --reset-cache
  • Deleted node_modules directory and reinstalled
  • Uninstalled and reinstalled node, watchman, react-native, and npm
  • Tried on physical device and simulator

Does anyone see anything that is wrong in my code or know what the issue might be? I'd be willing to converse over email or phone to solve this. I am getting desperate.



via tentmaking

No comments:

Post a Comment