나는 이것에 대한 수많은 게시물을 읽었지만 해결책을 찾을 수 없습니다. 나는 Babel/WebPack에 대해 생각할 필요가 없도록 Create-React-App으로 앱을 구축했습니다. 최근에 종속성을 업그레이드했는데 이 문제가 발생했습니다. 오류가 꽤 길지만 여기에 bundle.js 오류의 첫 번째 부분이 있습니다...
Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: .../src/StudentDashboard/ClientApp/node_modules/history/index.js: Cannot read properties of undefined (reading 'originalPositionFor')
앱은 프론트 엔드에서 React이고 백 엔드에서 .Net Core입니다. 나는 startup.cs에서 SPA를 시작합니다.
if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
다음을 시도했습니다.
- npx로 babel-upgrade 실행
- babel.config.json 추가
"presets": ["@babel/preset-env", "@babel/preset-react"]
- 개발자 종속성 추가
"@babel/core": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"babel-loader": "^8.2.3",
위의 어느 것도 오류를 수정하지 않았습니다. 만일의 경우를 대비하여 VS Code를 닫았다가 다시 시작했습니다. 수정 방법에 대한 모든 생각을 주시면 감사하겠습니다.
다음은 내 package.json... "react": "^17.0.2", "react-dom": "^17.0.2", "react-router-bootstrap": "^0.26.0의 React 항목입니다. ", "react-router-dom": "^6.2.1", "react-scripts": "^5.0.0", "reactstrap": "^9.0.1", [email protected]가 없습니다. 내가해야합니까?
Clay Hess2022-02-05 04:36:15내 잠금 파일을 샅샅이 뒤져 react-router(6.2.1)가 History: ^5.2.0의 종속성을 가지고 있음을 발견했습니다.
Clay Hess2022-02-05 04:36:15공유해 주신 링크로 이동했는데 문제가 해결되지 않았습니다. 게시물에 수정이 완료되었다고 나와 있지만 코어 7.16.12 및 라우터 돔 5.2.0으로 다운그레이드했습니다. 도움이되지 않았습니다. 다른 생각이 있습니까?
Clay Hess2022-02-05 04:36:15
당신은 [email protected]와 함께 [email protected]를 사용하고 있습니까? 호환되지 않기 때문에 [email protected]에 있어야 합니다.
dbuchet2022-02-05 04:36:15