2016-08-01 52 views
4

当我安装特定的NPM包,我的反应本地项目,并尝试运行它,我得到以下错误:阵营本地复制模块命名冲突

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似乎要安装其他反应以及与所有项目模块冲突的反应原生模块。

我想这样做的原因是因为特定版本的反应和应对本地模块被定义为反应母语条纹-API /的package.json的依赖:

"dependencies": { 
    "babel-polyfill": "6.9.1", 
    "react": "15.1.0", 
    "react-native": "0.27.2" 
    }, 

似乎像这些应该被删除。

能否有人对npm有更多的了解确认这实际上是定义节点依赖关系的正确方法。并解决问题的适当解决方案。

回答

5

你的评价是正确的

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

他们应该引用react作为peerDependencies

And the appropriate solution to resolve the problem.

的QuickFix:删除多余的反应版本

Longfix:Submit a pull request有反应作为peer dependency

0

您应该删除node_modules文件夹,然后执行npm cache clean,确保有你的项目的根文件夹下的任何临时缓存文件或文件夹(如react-native-packager-cache-81b2c446等),然后重新执行npm install