gpt4 book ai didi

react-native - 无法解析依赖树 - React Native Expo

转载 作者:行者123 更新时间:2023-12-04 11:29:56 26 4
gpt4 key购买 nike

我一直在用 React Native (Expo) 开始我的故事。有一天我需要安装 datetimepicker .不幸的是,我做错了什么。我试图自己面对这个问题。我删除了 node_modeles目录和 package.lock.json .当我尝试 npm install我收到以下错误:
错误信息

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@16.13.1
npm ERR! node_modules/react
npm ERR! react@"16.13.1" from the root project
npm ERR! peer react@">=16.8.3" from @react-native-community/datetimepicker@3.4.6
npm ERR! node_modules/@react-native-community/datetimepicker
npm ERR! @react-native-community/datetimepicker@"^3.0.4" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-native-windows@0.64.3
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows@">=0.62" from @react-native-community/datetimepicker@3.4.6
npm ERR! node_modules/@react-native-community/datetimepicker
npm ERR! @react-native-community/datetimepicker@"^3.0.4" 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.
我知道这是依赖版本错误的东西,但我不知道如何修复它:(
那是我的 package.json。
更新 package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.13.0",
"@react-native-picker/picker": "1.9.11",
"@react-navigation/bottom-tabs": "^5.11.10",
"@react-navigation/drawer": "^5.12.5",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.4",
"@types/expo__vector-icons": "^9.0.1",
"expo": "~41.0.0",
"expo-app-loading": "^1.0.3",
"expo-notifications": "~0.11.5",
"expo-sms": "~9.1.2",
"expo-status-bar": "~1.0.4",
"i18n-js": "^3.8.0",
"moment": "^2.29.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-pager-view": "5.0.12",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.0.0",
"react-native-tab-view": "^3.0.1",
"react-native-web": "^0.13.18",
"react-native-webview": "11.2.3",
"react-navigation-header-buttons": "^7.0.1",
"react-redux": "^7.2.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"@types/i18n-js": "^3.8.0",
"@types/react": "~16.9.35",
"@types/react-dom": "^17.0.3",
"@types/react-native": "~0.63.2",
"@types/react-redux": "^7.1.16",
"typescript": "~4.0.0"
},
"private": true
}
我怎样才能让它再次工作?

更新 #1
我创建了一个新项目,并通过 expo install 安装了所有依赖项,而没有 react-native-modal-datetime-picker .我已经复制并依赖于我的原始项目。当我使用 npm install 我的项目安装正确并显示以下消息时:
22:39 $ npm install
npm WARN deprecated deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

added 1087 packages, and audited 1088 packages in 30s

60 packages are looking for funding
run `npm fund` for details

12 low severity vulnerabilities

To address all issues (including breaking changes), run:
npm audit fix --force

Run `npm audit` for details.
现在我正在尝试安装 react-native-modal-datetime-picker ( https://github.com/mmazzarolo/react-native-modal-datetime-picker ),我收到错误:
22:44 $ expo install react-native-modal-datetime-picker @react-native-community/datetimepicker
Installing 1 SDK 41.0.0 compatible native module and 1 other package using npm.
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@16.13.1
npm ERR! node_modules/react
npm ERR! react@"16.13.1" from the root project
npm ERR! peer react@">=16.8.3" from @react-native-community/datetimepicker@3.2.0
npm ERR! node_modules/@react-native-community/datetimepicker
npm ERR! @react-native-community/datetimepicker@"3.2.0" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-native-windows@0.64.3
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows@">=0.62" from @react-native-community/datetimepicker@3.2.0
npm ERR! node_modules/@react-native-community/datetimepicker
npm ERR! @react-native-community/datetimepicker@"3.2.0" 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/adas/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/adas/.npm/_logs/2021-04-17T20_53_05_643Z-debug.log

npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
at ChildProcess.completionListener (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:467:12)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
...
at Object.spawnAsync [as default] (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
at NpmPackageManager._runAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:166:31)
at NpmPackageManager.addAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:105:18)
at installAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/src/commands/install.ts:130:3)
at Command.<anonymous> (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/src/exp.ts:349:7)

最佳答案

尝试将软件包更新到最新版本。

npm update
尝试使用 --force 安装如果更新不起作用,也标记。例如:
npm install --force

关于react-native - 无法解析依赖树 - React Native Expo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67142510/

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