creativetimofficial / light-bootstrap-dashboard-react

React version of Light Bootstrap Dashboard
MIT License
747 stars 1.03k forks source link

You should not use <Link> outside a <Router> #47

Closed OliverCole closed 5 years ago

OliverCole commented 5 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Expected Behavior

Main page renders.

Current Behavior

Render error: You should not use <Link> outside a <Router>

The above error occurred in the <Link> component:
index.js:2178
    in Link (created by Router.Consumer)
    in Router.Provider (created by Router.Consumer)
    in Router.Consumer (created by Route)
    in Route (created by NavLink)
    in NavLink (at Sidebar.jsx:70)
    in li (at Sidebar.jsx:62)
    in ul (at Sidebar.jsx:57)
    in div (at Sidebar.jsx:56)
    in div (at Sidebar.jsx:33)
    in Sidebar (at Dashboard.jsx:106)
    in div (at Dashboard.jsx:104)
    in Dashboard (created by Router.Consumer)
    in Router.Provider (created by Router.Consumer)
    in Router.Consumer (created by Route)
    in Route (at index.js:18)
    in Router.Consumer (created by Switch)
    in Switch (at index.js:16)
    in Router.Provider (created by Router)

Seems similar to https://github.com/creativetimofficial/material-kit-react/issues/25.

Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Get latest
  2. npm install
  3. npm start
  4. Load localhost:3000

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

See above.

terchris commented 5 years ago

I have tried the same. I get the same result on:

Mac Windows 10 Ubuntu 18.10 Ubuntu 18.04

smwade commented 5 years ago

Ya, the strange thing is that it built with no errors a week ago. I have tried with several versions of npm with no luck. I also tried with the other react templates on creativetim and those also have this error. The only way I have been able to remove it is commenting out every <NavLink> component under the <Sidebar>

OliverCole commented 5 years ago

Did you do an upgrade since? Would be super helpful to work out which package changed - as I think that’s probably the cause.

smwade commented 5 years ago

Ya that’s what I figured too, but It didn’t.... The package.json has no diffs on my repo. Also I am running in a docker container so I know that is consistent.

Is there any logs or things I can send you to get a better idea?

On Sun, Mar 17, 2019 at 11:59 PM OliverCole notifications@github.com wrote:

Did you do an upgrade since? Would be super helpful to work out which package changed - as I think that’s probably the cause.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/creativetimofficial/light-bootstrap-dashboard-react/issues/47#issuecomment-473780210, or mute the thread https://github.com/notifications/unsubscribe-auth/ALdqNlHKo1yuJR3ITBbMPDYYTkuIKhFLks5vXystgaJpZM4b4XF5 .

einazare commented 5 years ago

Hello there, guys,

Thank you for your interest in working with our products. Sorry for the late response, we do not work on weekends. In our package.json file we only install "react-router-dom". This package auto-installs "react-router". The problem is that is installing the latest version of "react-router", instead of the same version as "react-router-dom", and that is why you are having this error. Run the following command:

npm i -E react-router@4.2.2

And this will do the trick.

Best, Manu

smwade commented 5 years ago

Great thanks Manu! Thought I was going crazy. Just one thing, version 4.2.2 isn't on npmjs but 4.2.0 is and works great.