question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: react router dom 4.3.1 pulling react-router 4.4.0 changes after latest publish

See original GitHub issue

I’m seeing the following error:

   Warning: Please use `require("react-router").Router` instead of `require("react-router/Router")`. Support for the latter will be removed in the next major release.

 console.error node_modules/react-router-dom/node_modules/react-router/warnAboutDeprecatedCJSRequire.js:17
   Warning: Please use `require("react-router").MemoryRouter` instead of `require("react-router/MemoryRouter")`. Support for the latter will be removed in the next major release.

 console.error node_modules/react-router-dom/node_modules/react-router/warnAboutDeprecatedCJSRequire.js:17
   Warning: Please use `require("react-router").Route` instead of `require("react-router/Route")`. Support for the latter will be removed in the next major release.

 console.error node_modules/react-router-dom/node_modules/react-router/warnAboutDeprecatedCJSRequire.js:17
   Warning: Please use `require("react-router").Prompt` instead of `require("react-router/Prompt")`. Support for the latter will be removed in the next major release.

 console.error node_modules/react-router-dom/node_modules/react-router/warnAboutDeprecatedCJSRequire.js:17
   Warning: Please use `require("react-router").Redirect` instead of `require("react-router/Redirect")`. Support for the latter will be removed in the next major release.

 console.error node_modules/react-router-dom/node_modules/react-router/warnAboutDeprecatedCJSRequire.js:17
   Warning: Please use `require("react-router").StaticRouter` instead of `require("react-router/StaticRouter")`. Support for the latter will be removed in the next major release.

 console.error node_modules/react-router-dom/node_modules/react-router/warnAboutDeprecatedCJSRequire.js:17
   Warning: Please use `require("react-router").Switch` instead of `require("react-router/Switch")`. Support for the latter will be removed in the next major release.```


Inside the package.json file of react-router dom:

```"dependencies": {
   "history": "^4.7.2",
   "invariant": "^2.2.2",
   "loose-envify": "^1.3.1",
   "prop-types": "^15.5.4",
   "react-router": "^4.3.1",
   "warning": "^3.0.0"
 },```

It's downloading 4.4.0 due to this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:39 (15 by maintainers)

github_iconTop GitHub Comments

22reactions
mjacksoncommented, Mar 18, 2019

Quick update for anyone who’s watching this issue: I just unpublished 4.4.0 and re-released it as 5.0.0. v5 should be out as soon as https://travis-ci.org/ReactTraining/react-router/jobs/507926860 finishes.

14reactions
StringEpsiloncommented, Mar 16, 2019

Can confirm this bug with both yarn 1.15.2 and npm 6.9.0.

Curiously, codesandbox doesn’t have this issue.

Reproduction: https://github.com/StringEpsilon/react-router-bug-6630 (npm i; npm run start)

Edit: As a workaround, you can simply add

"react-router": "4.3.1",

or more explicetly:

  "resolutions": {
    "react-router": "4.3.1"
  },

to your package.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: react router dom 4.3.1 pulling react-router 4.4.0 changes ...
I'm seeing the following error: Warning: Please use `require("react-router").Router` instead of `require("react-router/Router")`.
Read more >
Tutorial v6.6.1 - React Router
Open up your terminal and bootstrap a new React app with Vite: ... This first route is what we often call the "root...
Read more >
Ion React Router does not route pages - Stack Overflow
My understanding is that ion react router is built on top of react router dom and that it functions pretty similarly.
Read more >
React Router v6 Preview
Ryan and I have been working on React Router since May 2014 ... One of the most exciting changes in v6 is the...
Read more >
react-router-dom - npm
Declarative routing for React web applications. Latest version: 6.4.2, last published: 8 days ago. Start using react-router-dom in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found