我一直在尝试将资料-ui-搜索-bar@beta安装到我的React项目中,但我一直在安装它时出错。我试过npm i material-ui-search-bar和npm i --save material-ui-search-bar@beta。
不管怎么说,我都会犯以下错误-
prerak@Preraks-MacBook-Pro React-frontend % npm i --save material-ui-search-bar@beta
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: gsoc1@0.1.0
npm ERR! Found: @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR! @material-ui/core@"^4.10.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @material-ui/core@"^1.0.0 || ^3.0.0" from material-ui-search-bar@1.0.0-beta.14
npm ERR! node_modules/material-ui-search-bar
npm ERR! material-ui-search-bar@"1.0.0-beta.14" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/prerak/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/prerak/.npm/_logs/2022-07-12T20_28_23_505Z-debug-0.log我不知道这是否有帮助,但这是我的依赖树-
"dependencies": {
"@date-io/date-fns": "^1.3.13",
"@material-ui/core": "^4.10.2",
"@material-ui/data-grid": "*",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "*",
"@material-ui/pickers": "^3.3.10",
"@react-google-maps/api": "^2.2.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.21.1",
"bootstrap": "^4.5.0",
"date-fns": "^2.22.1",
"firebase": "^9.8.3",
"mdbreact": "^4.27.0",
"moment": "^2.24.0",
"papaparse": "^5.3.1",
"react": "^17.0.0",
"react-bootstrap": "^1.0.1",
"react-bootstrap-sidebar": "0.0.1",
"react-chartjs-2": "^2.9.0",
"react-dom": "^17.0.0",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-sidebar": "^3.0.2",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"styled-components": "^5.1.1",
"uuid": "^8.3.2",
"vega-lite-api": "^5.0.0"
}这是错误日志文件-
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using npm@8.12.1
2 info using node@v16.14.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/Users/prerak/Developer/Git/OpenMF/React-frontend/.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:/Users/prerak/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 6ms
19 timing npm:load:configload Completed in 6ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm i material-ui-search-bar@beta
23 verbose argv "i" "--save" "material-ui-search-bar@beta"
24 timing npm:load:setTitle Completed in 5ms
25 timing config:load:flatten Completed in 1ms
26 timing npm:load:display Completed in 2ms
27 verbose logfile logs-max:10 dir:/Users/prerak/.npm/_logs
28 verbose logfile /Users/prerak/.npm/_logs/2022-07-12T20_28_23_505Z-debug-0.log
29 timing npm:load:logFile Completed in 3ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 18ms
33 timing arborist:ctor Completed in 0ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 timing idealTree:init Completed in 429ms
37 timing arborist:ctor Completed in 0ms
38 http fetch GET 200 https://registry.npmjs.org/material-ui-search-bar 382ms (cache hit)
39 timing idealTree:userRequests Completed in 386ms
40 silly idealTree buildDeps
41 silly fetch manifest material-ui-search-bar@1.0.0-beta.14
42 silly fetch manifest @material-ui/core@^4.10.2
43 http fetch GET 200 https://registry.npmjs.org/@material-ui%2fcore 4ms (cache hit)
44 silly fetch manifest @material-ui/core@^1.0.0 || ^3.0.0
45 silly fetch manifest @types/react@^16.8.6 || ^17.0.0
46 http fetch GET 200 https://registry.npmjs.org/@types%2freact 3ms (cache hit)
47 silly fetch manifest react@^17.0.0
48 http fetch GET 200 https://registry.npmjs.org/react 5ms (cache hit)
49 silly fetch manifest react-dom@^17.0.0
50 http fetch GET 200 https://registry.npmjs.org/react-dom 5ms (cache hit)
51 timing idealTree Completed in 860ms
52 timing command:i Completed in 863ms
53 verbose stack Error: unable to resolve dependency tree
53 verbose stack at Arborist.[failPeerConflict] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1428:25)
53 verbose stack at Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1394:34)
53 verbose stack at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:976:11)
53 verbose stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
53 verbose stack at async Promise.all (index 1)
53 verbose stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:153:5)
53 verbose stack at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:156:5)
53 verbose stack at async module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:78:5)
54 verbose cwd /Users/prerak/Developer/Git/OpenMF/React-frontend
55 verbose Darwin 21.5.0
56 verbose node v16.14.0
57 verbose npm v8.12.1
58 error code ERESOLVE
59 error ERESOLVE unable to resolve dependency tree
60 error
61 error While resolving: [1mgsoc1[22m@[1m0.1.0[22m
61 error Found: [1m@material-ui/core[22m@[1m4.12.4[22m[2m[22m
61 error [2mnode_modules/@material-ui/core[22m
61 error [1m@material-ui/core[22m@"[1m^4.10.2[22m" from the root project
61 error
61 error Could not resolve dependency:
61 error [35mpeer[39m [1m@material-ui/core[22m@"[1m^1.0.0 || ^3.0.0[22m" from [1mmaterial-ui-search-bar[22m@[1m1.0.0-beta.14[22m[2m[22m
61 error [2mnode_modules/material-ui-search-bar[22m
61 error [1mmaterial-ui-search-bar[22m@"[1m1.0.0-beta.14[22m" from the root project
61 error
61 error Fix the upstream dependency conflict, or retry
61 error this command with --force, or --legacy-peer-deps
61 error to accept an incorrect (and potentially broken) dependency resolution.
61 error
61 error See /Users/prerak/.npm/eresolve-report.txt for a full report.
62 verbose exit 1
63 timing npm Completed in 902ms
64 verbose unfinished npm timer reify 1657657703543
65 verbose unfinished npm timer reify:loadTrees 1657657703544
66 verbose unfinished npm timer idealTree:buildDeps 1657657704368
67 verbose unfinished npm timer idealTree:#root 1657657704368
68 verbose code 1
69 error A complete log of this run can be found in:
69 error /Users/prerak/.npm/_logs/2022-07-12T20_28_23_505Z-debug-0.log有人,请告诉我如何解决这个问题。
发布于 2022-07-12 22:34:26
从错误日志来看,资料UI 4和这个搜索栏不兼容:
material-ui-search-bar需要以下内容:
@material ui/core@“^1.0.0\x\ ^3.0.0”来源于资料-ui-search-bar@1.0.0-beta.14
安装了MUI 4.12.4。
使用此包的解决方案要么降级为MUI 3,要么使用另一个解决方案。
我个人建议考虑使用梅TextFields。
https://stackoverflow.com/questions/72958081
复制相似问题