我有一个 laravel-react 项目。当我们将项目上传到服务器时,它不会在 iphone 上显示任何内容。我们认为这可能是因为 npm 错误。每当我运行 npm update 时,它都会显示以下错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! dev react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-datepicker2@3.3.13
npm ERR! node_modules/react-datepicker2
npm ERR! react-datepicker2@"^3.3.13" 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 /home/ardalan/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2021-06-09T07_37_23_358Z-debug.log
这是2021-06-09T07_37_23_358Z-debug.log里面的数据:
0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'update' ]
1 info using npm@7.16.0
2 info using node@v14.15.5
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/var/www/html/exchange/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/home/ardalan/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/usr/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 5ms
19 timing npm:load:configload Completed in 5ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 1ms
22 timing npm:load:cleanupLog Completed in 2ms
23 timing npm:load:configScope Completed in 0ms
24 timing npm:load:projectScope Completed in 0ms
25 timing npm:load Completed in 8ms
26 timing config:load:flatten Completed in 2ms
27 timing arborist:ctor Completed in 0ms
28 timing idealTree:init Completed in 5ms
29 timing idealTree:userRequests Completed in 0ms
30 silly idealTree buildDeps
31 silly fetch manifest axios@^0.21.1
32 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules
33 http fetch GET 200 https://registry.npmjs.org/axios 111ms (cache hit)
34 silly fetch manifest babel-plugin-transform-class-properties@^6.24.1
35 http fetch GET 200 https://registry.npmjs.org/babel-plugin-transform-class-properties 575ms (cache hit)
36 silly fetch manifest component-will-mount-hook@^1.0.2
37 http fetch GET 200 https://registry.npmjs.org/component-will-mount-hook 2ms (cache hit)
38 silly fetch manifest react@^17.0.2
39 http fetch GET 200 https://registry.npmjs.org/react 4ms (cache hit)
40 silly fetch manifest react-dom@^17.0.2
41 http fetch GET 200 https://registry.npmjs.org/react-dom 3ms (cache hit)
42 silly fetch manifest dropify@^0.2.2
43 http fetch GET 200 https://registry.npmjs.org/dropify 2ms (cache hit)
44 silly fetch manifest jalali-moment@^3.3.10
45 http fetch GET 200 https://registry.npmjs.org/jalali-moment 2ms (cache hit)
46 silly fetch manifest lang.js@^1.1.14
47 http fetch GET 200 https://registry.npmjs.org/lang.js 2ms (cache hit)
48 silly fetch manifest moment@^2.29.1
49 http fetch GET 200 https://registry.npmjs.org/moment 5ms (cache hit)
50 silly fetch manifest moment-timezone@^0.5.33
51 http fetch GET 200 https://registry.npmjs.org/moment-timezone 2ms (cache hit)
52 silly fetch manifest path@^0.12.7
53 http fetch GET 200 https://registry.npmjs.org/path 2ms (cache hit)
54 silly fetch manifest pusher-js@^4.4.0
55 http fetch GET 200 https://registry.npmjs.org/pusher-js 2ms (cache hit)
56 silly fetch manifest react-bootstrap@^1.6.1
57 http fetch GET 200 https://registry.npmjs.org/react-bootstrap 3ms (cache hit)
58 silly fetch manifest react-data-table-component@^6.11.7
59 http fetch GET 200 https://registry.npmjs.org/react-data-table-component 3ms (cache hit)
60 silly fetch manifest styled-components@^5.3.0
61 http fetch GET 200 https://registry.npmjs.org/styled-components 3ms (cache hit)
62 silly fetch manifest react-is@^17.0.2
63 http fetch GET 200 https://registry.npmjs.org/react-is 3ms (cache hit)
64 silly fetch manifest react-data-table-component-extensions@^1.5.2
65 http fetch GET 200 https://registry.npmjs.org/react-data-table-component-extensions 3ms (cache hit)
66 silly fetch manifest react-datepicker@^3.8.0
67 http fetch GET 200 https://registry.npmjs.org/react-datepicker 6ms (cache hit)
68 silly fetch manifest react-datepicker2@^3.3.13
69 http fetch GET 200 https://registry.npmjs.org/react-datepicker2 3ms (cache hit)
70 silly fetch manifest react@^16.0.0
71 timing idealTree Completed in 797ms
72 timing command:update Completed in 814ms
73 verbose stack Error: unable to resolve dependency tree
73 verbose stack at Arborist.[failPeerConflict] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1210:25)
73 verbose stack at Arborist.[loadPeerSet] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1177:34)
73 verbose stack at async Arborist.[buildDepStep] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:880:11)
73 verbose stack at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
73 verbose stack at async Promise.all (index 1)
73 verbose stack at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:136:5)
73 verbose stack at async Update.update (/usr/lib/node_modules/npm/lib/update.js:72:5)
74 verbose cwd /var/www/html/exchange
75 verbose Linux 5.8.0-55-generic
76 verbose argv "/usr/bin/node" "/usr/bin/npm" "update"
77 verbose node v14.15.5
78 verbose npm v7.16.0
79 error code ERESOLVE
80 error ERESOLVE unable to resolve dependency tree
81 error
82 error While resolving: [1mundefined[22m@[1mundefined[22m
82 error Found: [1mreact[22m@[1m17.0.2[22m[2m[22m
82 error [2mnode_modules/react[22m
82 error [33mdev[39m [1mreact[22m@"[1m^17.0.2[22m" from the root project
82 error
82 error Could not resolve dependency:
82 error [35mpeer[39m [1mreact[22m@"[1m^16.0.0[22m" from [1mreact-datepicker2[22m@[1m3.3.13[22m[2m[22m
82 error [2mnode_modules/react-datepicker2[22m
82 error [1mreact-datepicker2[22m@"[1m^3.3.13[22m" from the root project
82 error
82 error Fix the upstream dependency conflict, or retry
82 error this command with --force, or --legacy-peer-deps
82 error to accept an incorrect (and potentially broken) dependency resolution.
82 error
82 error See /home/ardalan/.npm/eresolve-report.txt for a full report.
83 verbose exit 1
这是我的 package.json 文件:
{
"homepage": ".",
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"@babel/preset-react": "^7.13.13",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
"bootstrap": "^4.0.0",
"jquery": "^3.6.0",
"laravel-mix": "^6.0.19",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"postcss": "^8.2.14",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-refresh": "^0.9.0",
"resolve-url-loader": "^4.0.0",
"sass": "~1.34.1",
"sass-loader": "^8.0.0",
"webpack-shell-plugin": "^0.5.0",
"webpack-shell-plugin-next": "^2.2.2"
},
"dependencies": {
"axios": "^0.21.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"component-will-mount-hook": "^1.0.2",
"dropify": "^0.2.2",
"jalali-moment": "^3.3.10",
"lang.js": "^1.1.14",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"path": "^0.12.7",
"pusher-js": "^4.4.0",
"react-bootstrap": "^1.6.1",
"react-data-table-component": "^6.11.7",
"react-data-table-component-extensions": "^1.5.2",
"react-datepicker": "^3.8.0",
"react-datepicker2": "^3.3.13",
"react-input-mask": "^2.0.4",
"react-ion-slider": "^1.0.16",
"react-is": "^17.0.2",
"react-perfect-scrollbar": "^1.5.8",
"react-rangeslider": "^2.2.0",
"react-router-dom": "^5.2.0",
"react-sanctum": "^1.0.1",
"react-scrollspy-nav": "^1.2.4",
"react-select": "^4.3.1",
"react-slick": "^0.28.1",
"react-tinder-card": "^1.4.0",
"react-toastify": "^7.0.4",
"react-tradingview-widget": "^1.3.2",
"recharts": "^2.0.9",
"slick-carousel": "^1.8.1",
"styled-components": "^5.3.0"
}
}