Skip to content

Can't Resolve react-router-dom #231

@wuno

Description

@wuno

I am using react-bootstrap and react-router in my React application. I installed react-router-bootstrap so I could use Nav.Item and LinkContainer for my routes. Originally when I set it all up I kept getting this error.

./node_modules/react-router-bootstrap/lib/LinkContainer.js
Module not found: Can't resolve 'react-router-dom' in '/Users/wuno/Dropbox/Hack/Devops/react/riverwalk-credit-web/node_modules/react-router-bootstrap/lib'

I left the computer alone for a bit came back and started up the server again, npm start and it worked fine. At this point I decided to do some refactoring which broke it again giving me the same error as mentioned above. At this point I set everything back to the last working state and the error was still there.

I checked the node_modules directory and I do not see a react-router-dom inside of the lib folder or where it is even referencing this. But when I check the repo on git there does seem to be a reference for the library inside of LinkContainer.

I am thinking this must be a bug but this is my first time using any of these tools. All my experience is with react-native.

index.js

import { Router, Route } from 'react-router';
<Router>
      <div>
        <Navigation />
        <Route exact path="/" component={HomeContainer} />
      </div>
    </Router>

Navigation

import { LinkContainer } from 'react-router-bootstrap';
  <LinkContainer to="/">
     <NavItem>Home</NavItem>
   </LinkContainer>

Error

./node_modules/react-router-bootstrap/lib/LinkContainer.js
Module not found: Can't resolve 'react-router-dom' in '/Users/wuno/Dropbox/Hack/Devops/react/riverwalk-credit-web/node_modules/react-router-bootstrap/lib'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions