jest-haste-map:@providesModule命名冲突

时间:2017-08-21 06:39:51

标签: node.js

当我运行npm start或react-native start时,我收到了这个警告:

jest-haste-map: @providesModule naming collision:
  Duplicate module name: core-js
  Paths: {path_to_project}/node_modules/react-native/node_modules/core-js/package.json collides with {path_to_project}/node_modules/react-native/node_modules/fbjs/node_modules/core-js/package.json

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: base64-js
  Paths: {path_to_project}/node_modules/react-native/node_modules/base64-js/package.json collides with {path_to_project}/node_modules/react-native/node_modules/simple-plist/node_modules/base64-js/package.json

This warning is caused by a @providesModule declaration with the same name across two different files.

这是我的package.json文件

{
  "name": "ProjectName",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "chroma-js": "^1.3.4",
    "crypto-js": "^3.1.9-1",
    "mobile-center": "^0.7.0",
    "mobile-center-analytics": "^0.7.0",
    "mobile-center-crashes": "^0.7.0",
    "mobx": "^3.1.10",
    "mobx-react": "^4.1.8",
    "react": "16.0.0-alpha.12",
    "react-addons-shallow-compare": "^15.5.2",
    "react-mixin": "^2.0.2",
    "react-native": "^0.45.1",
    "react-native-animatable": "^1.2.2",
    "react-native-baidu-map": "^0.6.0",
    "react-native-linear-gradient": "^2.0.0",
    "react-native-root-toast": "^1.1.2",
    "react-native-smart-splash-screen": "^2.3.4",
    "react-native-vector-icons": "^4.2.0",
    "react-navigation": "^1.0.0-beta.11",
    "react-timer-mixin": "^0.13.3",
    "realm": "^1.10.0"
  },
  "devDependencies": {
    "babel-jest": "20.0.3",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-react-native": "2.0.0",
    "jest": "20.0.4",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "jest": {
    "preset": "react-native"
  }
}

我的开发环境是:

node: v6.11.2
npm: 3.10.10
os: macOS Sierra

我已经尝试过任何方式,例如更新RN版本,清除watchMan缓存,指定所有依赖项的版本,调整devDependencies的版本,如babel-jest的版本,但所有这些都做了不行。我不知道出了什么问题,我需要帮助。或者是否是一个问题。

感激不尽!

1 个答案:

答案 0 :(得分:0)

可能您已经使用名称生成了项目,然后将name中的package.json属性更改为其他名称。

检查app.jsonpackage.json文件,以查看应用程序所有文件中的项目名称是否相同