error: bundling failed: Error: Unable to resolve module `react-native-vector-icons/Feather`

Viewed 18604

In React native I'm simply applying a Flatlist from react native library. Succefully installed all libraries

pakage.json

  "dependencies": {
    "feather-icons-react": "^0.3.0",
    "react": "16.6.3",
    "react-native": "0.57.8",
    "react-native-elements": "^1.0.0-beta7",
    "react-native-vector-icons": "^4.2.0"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.51.0",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

App.js

import React, {Component} from 'react';
import Main from './components/MainComponents';

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (

        <Main />

    );
  }
}

error log

    error: bundling failed: Error: Unable to resolve module `react-native-vector-icons/Feather` from `F:\React Native\FirstProject\node_modules\react-native-elements\src\helpers\getIconType.js`: Module `react-native-vector-icons/Feather` does not exist in the Haste module map

newbie to react native

Help will be highy appreciated

Thankyou

4 Answers

To install react-native-vector-icons, you need to install it, then link it. First run:
npm install react-native-vector-icons --save
or if you use yarn
yarn add react-native-vector-icons

Then, you will have to link it like this:
react-native link react-native-vector-icons

  1. close running packager

  2. run react-native link react-native-vector-icons

  3. run react-native start --reset-cache

  4. Finally use react-native run-ios

This command is worked in my case

react-native start --reset-cache

make sure that you've installed the package with yarn add react-native-vector-icons and then reset packager cache with react-native start --reset-cache

Related