React Native Duplicate模块命名冲突

Shi*_*nha 5 npm reactjs react-native

当我将特定的npm包安装到我的react本机项目并尝试运行它时,我收到以下错误:

This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
Duplicate module name: promiseRejectionIsError
Paths:

projectname/node_modules/react-native-stripe-api/node_modules/react-native/Libraries/promiseRejectionIsError.js collides with

projectname/node_modules/react-native/Libraries/promiseRejectionIsError.js
Run Code Online (Sandbox Code Playgroud)

问题:这个软件包react-native-stripe-api似乎正在安装另一个react和react-native模块,它与所有项目模块冲突.

我认为这是因为在react-native-stripe-api/package.json中将特定版本的react和react-native模块定义为依赖项:

  "dependencies": {
    "babel-polyfill": "6.9.1",
    "react": "15.1.0",
    "react-native": "0.27.2"
  },
Run Code Online (Sandbox Code Playgroud)

似乎应该删除这些.

有更多关于npm的知识的人可以确认这实际上是定义节点依赖关系的正确方法.以及解决问题的适当解决方案.

Kyl*_*ley 6

您的评估是正确的

有更多关于npm的知识的人可以确认这实际上是定义节点依赖关系的正确方法.

它们应该react作为peerDependencies引用

以及解决问题的适当解决方案.

Quickfix:删除额外的反应版本

Longfix: 提交一个pull请求,作为对等依赖项做出反应