Connected-react-router: You should not use <Route> outside a <Router>

Created on 17 Apr 2019  路  4Comments  路  Source: supasate/connected-react-router

After update react-router to version 5.0.0 and connectedReactRouter to version 6.4.0 still having an error in console:
Error: Invariant failed: You should not use outside a

Most helpful comment

I've ran into this issue before, make sure your react-router and react-router-dom are the same version (5.0) do a npm cache clean or yarn cache clean, remove node_modules and package-lock.json/yarn.lock and do a npm install/yarn install.

All 4 comments

I've ran into this issue before, make sure your react-router and react-router-dom are the same version (5.0) do a npm cache clean or yarn cache clean, remove node_modules and package-lock.json/yarn.lock and do a npm install/yarn install.

@austsinovich have you found any solution to this problem?

i tried clearing out and reinstalling, but it's still not working, changed react-router-dom to: "4.3.1" works

yes. even though react-router-dom ^4.3.1 depends on react-router ^4.3.1, npm decides its funny to install react-router-dom 5.0.0, even though you already have react-router ^4.3.1 installed. A normal package manager would find out that ^4.3.1 is the only matching package version, however npm is not a normal package manager.

I know of no package manager with that many stupid upside down behaviors as npm (not rust, not php, not java, not anything). Yeah but its always some super smart logical reason why that has to do upside down. Like the stupid lockfile behavior. Usually excused because "it was always like that, we want bc, but we created a new executable, which does as you expect", introducing thereby other issues which would never have existed in first place if simply being logical.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hauptrolle picture hauptrolle  路  3Comments

AdrienLemaire picture AdrienLemaire  路  5Comments

alexseitsinger picture alexseitsinger  路  3Comments

Hardtack picture Hardtack  路  3Comments

preciselywilliam picture preciselywilliam  路  4Comments