添加模块时出错:提供此模块的多个文件

时间:2017-10-16 13:17:17

标签: reactjs react-native npm yarnpkg

我正在尝试使用命令yarn add react-native-navigation-drawer在我的项目上安装react-native-navigation-drawer

执行命令后,运行应用程序时出错。

/Users/reactProject/node_modules/react-native/package.json
2017-10-16 15:10:43.664017+0200 mobilizeit[23431:100610] Ambiguous resolution: module '/Users/reactProject/index.ios.js' tries to require 'react-native', but there are several files providing this module. You can delete or fix them: 

/Users/reactProject/node_modules/react-native-drawer-layout-polyfill/node_modules/react-native/package.json

/Users/reactProject/node_modules/react-native-navigation-drawer/node_modules/react-native/package.json

/Users/reactProject/node_modules/react-native-tab-view/node_modules/react-native/package.json

/Users/reactProject/node_modules/react-native/package.json

我是反应原生的新手。你能帮我解决一下这个问题吗? 修改

使用命令yarn start --reset-cache我收到了很多警告:

This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
  Duplicate module name: Sample
  Paths: /Users/reactProject/node_modules/react-native-navigation-drawer/node_modules/react-native/Libraries/Sample/Sample.ios.js collides with /Users/reactProject/node_modules/react-native-drawer-layout-polyfill/node_modules/react-native/Libraries/Sample/Sample.ios.js

This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
  Duplicate module name: Settings
  Paths: /Users/reactProject/node_modules/react-native-navigation-drawer/node_modules/react-native/Libraries/Settings/Settings.ios.js collides with /Users/reactProject/node_modules/react-native-drawer-layout-polyfill/node_modules/react-native/Libraries/Settings/Settings.ios.js

1 个答案:

答案 0 :(得分:0)

尝试此命令

"dependencies": { 
  "foobar": "1.0.0",
  "react": "~16.0.0",
  "react-dom": "~16.0.0",
  "prop-types": "^15.6.0"
}