当前位置 : 主页 > 网页制作 > React >

reactjs – React Native Duplicate模块命名冲突

来源:互联网 收集:自由互联 发布时间:2021-06-15
当我将特定的npm包安装到我的react本机项目并尝试运行它时,我收到以下错误: This error is caused by a @providesModule declaration with the same name accross two different files.Error: @providesModule naming collis
当我将特定的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

问题:这个包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"
  },

似乎应该删除这些.

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

您的评估是正确的

Could someone with more knowledge about npm confirm this is actually the correct way of defining node dependencies.

他们应该参考作为peerDependencies的反应

And the appropriate solution to resolve the problem.

Quickfix:删除额外的反应版本

Longfix:Submit a pull request,反应为peer dependency

网友评论