jest-haste-map:@providesReact Native中的模块命名冲突

时间:2019-03-07 11:20:15

标签: react-native caching npm collision npm-start

我为图表集成的第三方库(融合图表)出现以下错误。

我检查了所有可能性,仍然遇到相同的问题,我被困在这里。

jest-haste-map: @providesModule naming collision:
  Duplicate module name: fusioncharts
  Paths: /Users/anilkumar/Documents/ProjectName/android/app/build/intermediates/merged_assets/debug/mergeDebugAssets/out/fusioncharts/package.json collides with /Users/anilkumar/Documents/ProjectName/android/app/src/main/assets/fusioncharts/package.json

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

Error: jest-haste-map: @providesModule naming collision:
  Duplicate module name: fusioncharts
  Paths: /Users/anilkumar/Documents/ProjectName/android/app/build/intermediates/merged_assets/debug/mergeDebugAssets/out/fusioncharts/package.json collides with /Users/anilkumar/Documents/ProjectNameandroid/app/src/main/assets/fusioncharts/package.json

我已经通过以下解决方案解决了这个问题。

watchman watch-del-all
npm cache clean --force
npm cache verify
npm cache clean && npm start -- --reset-cache

此外,我在根项目中添加了以下.js文件

rn-cli.config.js

const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
  resolver: {
    blacklistRE: blacklist([
      /nodejs-assets\/.*/,
      /android\/.*/,
      /ios\/.*/
    ])
  },
};

在iOS和Android中仍然出现相同的问题,并且无法运行该应用程序。

该如何解决?

0 个答案:

没有答案