首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >响应包中的fbjs命名冲突错误,然后是keyMirror解析错误

响应包中的fbjs命名冲突错误,然后是keyMirror解析错误
EN

Stack Overflow用户
提问于 2016-03-06 19:08:33
回答 2查看 611关注 0票数 1

在将react本机项目升级到0.21.0之后,我在运行react时遇到了这个错误:

Failed to build DependencyGraph: Naming collision detected: /Users/xxxxxxxx/node_modules/react/node_modules/fbjs/lib/warning.js collides with /Users/xxxxxxx/node_modules/react-native/node_modules/fbjs/lib/warning.js

我尝试过fbjs和清理缓存,以及使用npm3安装我的依赖项,但是这会导致模块解析错误:

Unable to resolve module keyMirror from /Users/xxxxxxx/node_modules/react-native/Libraries/Utilities/MessageQueue.js: Unable to find this module in its module map or any of the node_modules directories under /Users/node_modules/keyMirror and its parent directories

它建议重置缓存并重新安装node_modules,但这不能解决问题。

我的package.json

{ "name": "myproject", "version": "0.0.1", "private": true, "scripts": { "start": "react-native start" }, "dependencies": { "@exponent/react-native-navigator": "^0.4.2", "flux": "^2.1.1", "react-native": "^0.21.0", "react-native-action-button": "^1.1.2", "react-native-audio": "^0.3.2", "react-native-blur": "^0.7.7", "react-native-image-picker": "^0.10.0", "react-native-lightbox": "^0.5.0", "react-native-search-bar": "^2.7.0", "react-native-vector-icons": "^1.0.4" }, "devDependencies": { "babel-eslint": "^5.0.0", "eslint": "^2.2.0", "eslint-plugin-react": "^3.16.1" } }

我怀疑启动一个新的项目会解决这个问题,因为它显然与依赖冲突有关。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-03-06 19:42:56

最后我用这个脚本解决了这个问题:

https://github.com/facebook/react-native/issues/5467#issuecomment-187873411

代码语言:javascript
复制
'use strict';

const blacklist = require('react-native/packager/blacklist');

var config = [
  /{root folder name}\/node_modules\/.+\/node_modules\/fbjs\/.*/
]

module.exports = {
  getBlacklistRE() {
    return blacklist('', config);
  },
};
票数 1
EN

Stack Overflow用户

发布于 2016-03-06 19:20:24

你试过jrichardlai于1月22日发表评论留下的这个技巧了吗?

对于仍然面临此问题的人,临时的方法可以是在package.json中添加fbjs作为依赖项,然后在postinstall中运行脚本以删除额外的fbjs https://gist.github.com/jrichardlai/a6a36352e1b98eb2946a

与要旨相关的链接。

代码语言:javascript
复制
find ./node_modules -type d -name fbjs -and -not -path ./node_modules/fbjs -print -exec rm -rf "{}" \;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35831234

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档