gpt4 book ai didi

node.js - 尝试导入错误 : 'createLocation' is not exported from 'history'

转载 作者:行者123 更新时间:2023-12-03 12:17:50 25 4
gpt4 key购买 nike

我刚刚折射了我的代码,现在我收到了这个错误

./node_modules/react-router-dom/esm/react-router-dom.js
Attempted import error : 'createLocation' is not exported from 'history'.
如何修复此错误,我尝试在 Google 上搜索解决方案,但找不到有关此错误的任何信息,我也尝试更新 react-router-dom 和历史记录,但没有帮助,我还尝试卸载并重新安装 react-router-dom 和历史记录并删除 node_modules 并使用 npm install 没有任何帮助,而且我没有在任何地方使用 createLocation
我的 package.json:
 "name": "newdating",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"history": "^5.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-select": "^3.1.0",
"styled-components": "^5.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}

最佳答案

您显然有 history 的版本冲突和 react-router .根据history自述文件:
“(历史)版本 5 用于 React Router 版本 6。
版本 4 的文档可以在 v4 分支上找到。版本 4 用于 React Router 版本 4 和 5。”

关于node.js - 尝试导入错误 : 'createLocation' is not exported from 'history' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63303834/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com