我有一个react-native
项目,带有以下package.json
文件:
{
"name": "react-native-paper-example",
"version": "0.0.1",
"description": "Example for React Native Paper",
"author": "",
"private": true,
"scripts": {
"flow": "flow",
"start": "expo start",
"android": "expo android",
"ios": "expo ios"
},
"main": "node_modules/expo/AppEntry.js",
"dependencies": {
"@expo/vector-icons": "^9.0.0",
"create-react-context": "^0.2.3",
"expo": "^32.0.0",
"expo-core": "^2.0.0",
"expo-font": "^2.0.0",
"query-string": "^6.2.0",
"react": "16.7.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-paper": "^2.4.0",
"react-native-svg": "^9.0.5",
"react-navigation": "^3.0.9"
},
"devDependencies": {
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-expo": "^5.0.0",
"expo-cli": "^2.3.8",
"flow-bin": "^0.91.0"
},
"resolutions": {
"**/create-react-context": "0.2.3",
"**/hoist-non-react-statics": "2.5.0",
"**/react-lifecycles-compat": "3.0.4",
"**/react": "16.5.0"
}
}
要安装我运行的模块:
$ yarn install
我的问题是我跑步时出现的问题:
$ expo start
我收到以下错误:
[02:30:45] Your app is running at exp://192.168.1.194:19000
Logs for your project will appear below. Press Ctrl+C to exit.
[02:30:56] (node:6184) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision:
[02:30:56] Duplicate module name: react
[02:30:56] Paths: D:\react-native-app\node_modules\create-react-context\node_modules\react\package.json collides with D:\react-native-app\node_modules\react\package.json
[02:30:56]
[02:30:56] This error is caused by a @providesModule declaration with the same name across two different files.
[02:30:56] at setModule (D:\react-native-app\node_modules\jest-haste-map\build\index.js:462:17)
[02:30:56] at workerReply (D:\react-native-app\node_modules\jest-haste-map\build\index.js:512:9)
[02:30:56] at <anonymous>
[02:30:56] at process._tickCallback (internal/process/next_tick.js:188:7)
[02:30:56] (node:6184) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
[02:30:56] (node:6184) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
关于如何解决此问题的任何想法?
谢谢!
答案 0 :(得分:0)
您可能应该从分辨率中删除此行"**/react": "16.5.0"
,因为它与您指定为依赖项的React版本不兼容:"react": "16.7.0",