title: Cannot read properties of undefined (reading 'originalPositionFor')
body: <p>I am a beginner to react, just started the topic react-router-dom tutorials.
  Firstly I installed the react-router-dom using  <code>npm i react-router-dom</code>
  Then in app.js I use the by-default code in the function Header and call this element in the react-router-dom structure:</p>
  <pre><code>import logo from './logo.svg';
  import './App.css';
  import {  BrowserRouter as Router,Routes,Route} from &quot;react-router-dom&quot;;
  
  function App() {
    return (
      &lt;Router&gt;
      &lt;Routes&gt;
        &lt;Route path=&quot;/&quot; element={&lt;Header /&gt;} /&gt;
      &lt;/Routes&gt;
    &lt;/Router&gt;
    );
  }
  export default App;
  function Header(){
    return(
      &lt;div className=&quot;App&quot;&gt;
    &lt;header className=&quot;App-header&quot;&gt;
      &lt;img src={logo} className=&quot;App-logo&quot; alt=&quot;logo&quot; /&gt;
      &lt;p&gt;Edit &lt;code&gt;src/App.js&lt;/code&gt; and save to reload.&lt;/p&gt;
      &lt;a className=&quot;App-link&quot; href=&quot;https://reactjs.org&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;
        Learn React
      &lt;/a&gt;
    &lt;/header&gt;
  &lt;/div&gt;
    );
    
  }
  </code></pre>
  <p>and when I start the server using <code>npm start</code> I got this error:</p>
  <pre><code>log.js:59 Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
  TypeError: E:\REACT TRAINING\ReactRouter\node_modules\history\index.js: Cannot read properties of undefined (reading 'originalPositionFor')
      at SourceMapTree.originalPositionFor (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@ampproject\remapping\dist\remapping.umd.js:159:27)
      at trace (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@ampproject\remapping\dist\remapping.umd.js:102:37)
      at EncodedSourceMapImpl.map (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@jridgewell\trace-mapping\dist\trace-mapping.umd.js:347:36)
      at TraceMap.map (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@jridgewell\trace-mapping\dist\trace-mapping.umd.js:430:31)
      at SourceMapTree.traceMappings (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@ampproject\remapping\dist\remapping.umd.js:85:34)
      at remapping (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@ampproject\remapping\dist\remapping.umd.js:258:36)
      at mergeSourceMap (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@babel\core\lib\transformation\file\merge-map.js:19:30)
      at generateCode (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@babel\core\lib\transformation\file\generate.js:72:39)
      at run (E:\REACT TRAINING\ReactRouter\my-app\node_modules\@babel\core\lib\transformation\index.js:55:33)
      at run.next (&lt;anonymous&gt;)
      at Object.../node_modules/history/index.js (http://localhost:3000/static/js/bundle.js:41373:7)
      at Object.options.factory (http://localhost:3000/static/js/bundle.js:46449:31)
      at __webpack_require__ (http://localhost:3000/static/js/bundle.js:45899:33)
      at fn (http://localhost:3000/static/js/bundle.js:46120:21)
      at Module.../node_modules/react-router-dom/index.js (http://localhost:3000/static/js/bundle.js:41527:65)
      at Module.options.factory (http://localhost:3000/static/js/bundle.js:46449:31)
      at __webpack_require__ (http://localhost:3000/static/js/bundle.js:45899:33)
      at fn (http://localhost:3000/static/js/bundle.js:46120:21)
      at Module../src/App.js (http://localhost:3000/static/js/bundle.js:68:74)
      at Module.options.factory (http://localhost:3000/static/js/bundle.js:46449:31)
  
   
  </code></pre>
  <p>I tried to find various sources bt not able to find any solutiion.</p>
  <p>Dependencies:<code>dependencies&quot;: { &quot;@testing-library/jest-dom&quot;: &quot;^5.16.2&quot;, &quot;@testing-library/react&quot;: &quot;^12.1.2&quot;, &quot;@testing-library/user-event&quot;: &quot;^13.5.0&quot;, &quot;react&quot;: &quot;^17.0.2&quot;, &quot;react-dom&quot;: &quot;^17.0.2&quot;, &quot;react-scripts&quot;: &quot;5.0.0&quot;, &quot;web-vitals&quot;: &quot;^2.1.4&quot; }</code></p>