I am just trying to install react
but I am getting errors.
I have installed npm -v 8.12.1 version in my system. I have tried to downgrade react but it doesn’t help
I have tried these type:
- update npm
npm install npm -g
- downgraded react to
"react": "15.3.0"
- cleared cache:
npm cache clear
- removed node_modules,
rm -rf node_modules
, - reinstalled node_modules,
npm install
JavaScript
x
115
115
1
{
2
"name": "ant-design-pro",
3
"version": "2.0.0",
4
"description": "An out-of-box UI solution for enterprise applications",
5
"private": true,
6
"scripts": {
7
"precommit": "npm run lint-staged",
8
"presite": "node ./scripts/generateMock.js && cd functions && npm install",
9
"start": "cross-env APP_TYPE=site umi dev",
10
"start:no-mock": "cross-env MOCK=none umi dev",
11
"build": "umi build",
12
"site": "npm run presite && cross-env APP_TYPE=site npm run build && firebase deploy",
13
"analyze": "cross-env ANALYZE=1 umi build",
14
"lint:style": "stylelint "src/**/*.less" --syntax less",
15
"lint": "eslint --ext .js src mock tests && npm run lint:style",
16
"lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
17
"lint-staged": "lint-staged",
18
"lint-staged:js": "eslint --ext .js",
19
"test": "umi test",
20
"test:component": "umi test ./src/components",
21
"test:all": "node ./tests/run-tests.js",
22
"prettier": "prettier --write ./src/**/**/**/*",
23
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
24
"docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
25
"docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
26
"docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build"
27
},
28
"dependencies": {
29
"@antv/data-set": "^0.9.6",
30
"@babel/runtime": "^7.0.0",
31
"antd": "^3.11.6",
32
"bizcharts": "^3.2.2",
33
"bizcharts-plugin-slider": "^2.0.3",
34
"classnames": "^2.2.6",
35
"dva": "^2.4.0",
36
"enquire-js": "^0.2.1",
37
"hash.js": "^1.1.5",
38
"highlight.js": "^9.13.1",
39
"lodash": "^4.17.10",
40
"lodash-decorators": "^6.0.0",
41
"marked": "^0.5.2",
42
"memoize-one": "^4.0.0",
43
"moment": "^2.22.2",
44
"numeral": "^2.0.6",
45
"nzh": "^1.0.3",
46
"omit.js": "^1.0.0",
47
"path-to-regexp": "^2.4.0",
48
"prop-types": "^15.5.10",
49
"qs": "^6.5.2",
50
"rc-animate": "^2.4.4",
51
"react": "^16.8.6",
52
"react-container-query": "^0.11.0",
53
"react-copy-to-clipboard": "^5.0.1",
54
"react-document-title": "^2.0.3",
55
"react-dom": "^16.8.6",
56
"react-fittext": "^1.0.0",
57
"react-router-dom": "^4.3.1",
58
"save": "^2.3.2",
59
"simplemde": "^1.11.2"
60
},
61
"devDependencies": {
62
"@types/react": "^16.4.11",
63
"@types/react-dom": "^16.0.6",
64
"antd-pro-merge-less": "^0.0.9",
65
"antd-pro-theme-webpack-plugin": "^1.1.8",
66
"babel-eslint": "^9.0.0",
67
"babel-plugin-transform-decorators-legacy": "^1.3.5",
68
"cross-env": "^5.1.1",
69
"cross-port-killer": "^1.0.1",
70
"enzyme": "^3.4.4",
71
"eslint": "^5.4.0",
72
"eslint-config-airbnb": "^17.0.0",
73
"eslint-config-prettier": "^3.0.1",
74
"eslint-plugin-babel": "^5.1.0",
75
"eslint-plugin-compat": "^2.5.1",
76
"eslint-plugin-import": "^2.8.0",
77
"eslint-plugin-jsx-a11y": "^6.0.3",
78
"eslint-plugin-markdown": "^1.0.0-beta.6",
79
"eslint-plugin-react": "^7.11.1",
80
"gh-pages": "^2.0.0",
81
"husky": "^0.14.3",
82
"lint-staged": "^7.2.0",
83
"merge-umi-mock-data": "^0.0.3",
84
"mockjs": "^1.0.1-beta3",
85
"prettier": "1.14.2",
86
"pro-download": "^1.0.1",
87
"stylelint": "^9.4.0",
88
"stylelint-config-prettier": "^4.0.0",
89
"stylelint-config-standard": "^18.0.0",
90
"umi": "^2.1.1",
91
"umi-plugin-ga": "^1.0.3",
92
"umi-plugin-react": "^1.1.1"
93
},
94
"optionalDependencies": {
95
"puppeteer": "^1.6.0"
96
},
97
"lint-staged": {
98
"**/*.{js,jsx,less}": [
99
"prettier --write",
100
"git add"
101
],
102
"**/*.{js,jsx}": "npm run lint-staged:js",
103
"**/*.less": "stylelint --syntax less"
104
},
105
"engines": {
106
"node": ">=8.0.0"
107
},
108
"browserslist": [
109
"> 1%",
110
"last 2 versions",
111
"not ie <= 10"
112
]
113
}
114
115
JavaScript
1
43
43
1
npm ERR! code ERESOLVE
2
npm ERR! ERESOLVE could not resolve
3
npm ERR!
4
npm ERR! While resolving: react-fittext@1.0.0
5
npm ERR! Found: react@16.14.0
6
npm ERR! node_modules/react
7
npm ERR! react@"^16.8.6" from the root project
8
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from @ant-design/create-react-context@0.2.5
9
npm ERR! node_modules/@ant-design/create-react-context
10
npm ERR! @ant-design/create-react-context@"^0.2.4" from antd@3.26.20
11
npm ERR! node_modules/antd
12
npm ERR! antd@"^3.11.6" from the root project
13
npm ERR! 1 more (umi-plugin-react)
14
npm ERR! @ant-design/create-react-context@"^0.2.4" from rc-mentions@0.4.2
15
npm ERR! node_modules/rc-mentions
16
npm ERR! rc-mentions@"~0.4.0" from antd@3.26.20
17
npm ERR! node_modules/antd
18
npm ERR! antd@"^3.11.6" from the root project
19
npm ERR! 1 more (umi-plugin-react)
20
npm ERR! 2 more (rc-tabs, rc-tree)
21
npm ERR! 47 more (@ant-design/icons-react, airbnb-prop-types, antd, )
22
npm ERR!
23
npm ERR! Could not resolve dependency:
24
npm ERR! peer react@"^15.0.0" from react-fittext@1.0.0
25
npm ERR! node_modules/react-fittext
26
npm ERR! react-fittext@"^1.0.0" from the root project
27
npm ERR!
28
npm ERR! Conflicting peer dependency: react@15.7.0
29
npm ERR! node_modules/react
30
npm ERR! peer react@"^15.0.0" from react-fittext@1.0.0
31
npm ERR! node_modules/react-fittext
32
npm ERR! react-fittext@"^1.0.0" from the root project
33
npm ERR!
34
npm ERR! Fix the upstream dependency conflict, or retry
35
npm ERR! this command with --force, or --legacy-peer-deps
36
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
37
npm ERR!
38
npm ERR! See C:Users91639AppDataLocalnpm-cacheeresolve-report.txt for a full report.
39
40
npm ERR! A complete log of this run can be found in:
41
npm ERR! C:Users91639AppDataLocalnpm-cache_logs2022-06-03T09_27_25_556Z-debug-0.log
42
43
Advertisement
Answer
As the error reads, you have dependency conflict. Run the command with –legacy-peer-deps.
JavaScript
1
2
1
npm install --legacy-peer-deps
2