Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Cannot read properties of undefined (reading 'originalPositionFor')

I am a beginner to react, just started the topic react-router-dom tutorials. Firstly I installed the react-router-dom using npm i react-router-dom Then in app.js I use the by-default code in the function Header and call this element in the react-router-dom structure:

import logo from './logo.svg';
import './App.css';
import {  BrowserRouter as Router,Routes,Route} from "react-router-dom";

function App() {
  return (
    <Router>
    <Routes>
      <Route path="/" element={<Header />} />
    </Routes>
  </Router>
  );
}
export default App;
function Header(){
  return(
    <div className="App">
  <header className="App-header">
    <img src={logo} className="App-logo" alt="logo" />
    <p>Edit <code>src/App.js</code> and save to reload.</p>
    <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer">
      Learn React
    </a>
  </header>
</div>
  );
  
}

and when I start the server using npm start I got this error:

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 (<anonymous>)
    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)

 

I tried to find various sources bt not able to find any solutiion.

Dependencies:dependencies": { "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "5.0.0", "web-vitals": "^2.1.4" }

over 4 years ago · Santiago Trujillo
4 answers
Answer question

0

I'm also stuck into this. When importing BrowserRouter.

over 4 years ago · Santiago Trujillo Report

0

Downgrade @babel/core to previous version which fixed it for me

npm i -D @babel/core@7.16.12

over 4 years ago · Santiago Trujillo Report

0

Downgrade react-scripts@4.0.3 working for me.

npm i react-scripts@4.0.3
over 4 years ago · Santiago Trujillo Report

0

Try @babel/core@7.16.12 with no caret (^). It seems like the latest (7.17.0) that was released today is broken.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!