Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve module 'react-redux'...module 'react-redux' does not exist in haste module map

The code in app.js file with import statements for react redux is created to display a header with a text called "Tech stack".

App.js

import React from 'react';
import { View } from 'react-native';
import { Header } from './components/common';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from './reducers';


const App = () => {
  return(
    <Provider store={createStore(reducers)}>
      <View>
        <Header headerText="Tech Stack" />
      </View>
    </Provider>
  );
};

export default App;

This is the index file

index.js

import { AppRegistry } from 'react-native';
import App from './src/App';


AppRegistry.registerComponent(tech_stack, () => App);

While running this on the terminal, it throws a error saying unable to resolve module 'react-redux'.

like image 964
Saranya Avatar asked Mar 03 '23 18:03

Saranya


2 Answers

Close the JS bundle(a terminal starts when you run app for first time) and rerun it using the command react-native start from the project path. Basically, you need to rerun the JS bundle after every package installation.

like image 142
Nabeel K Avatar answered Apr 05 '23 23:04

Nabeel K


Install 'react-redux' by using

npm install --save react-redux

if you not installed it. By seeing your comment as you mentioned that you installed redux only. Then restart the JS bundle by using

react-native start --reset-cache

like image 44
A. Wahab Avatar answered Apr 05 '23 22:04

A. Wahab