Error: jest-haste-map: Haste module naming collision:

前端 未结 3 2018
挽巷
挽巷 2021-02-18 23:30

I have created a custom npm module (will use xxx instead of its name) and link it manually using npm install.

I tried very har

相关标签:
3条回答
  • 2021-02-19 00:11

    Add rn-cli.config.js In the root project

    const blacklist = require('metro-config/src/defaults/blacklist');
    module.exports = {
     resolver: {
        blacklistRE: blacklist([
            /node_modules\/.*\/node_modules\/react-native\/.*/,
        ])
     },
    };
    

    see this issue

    Hope it works for you

    0 讨论(0)
  • 2021-02-19 00:12

    It looks like you have a 2 different react-native project folders where one is dependent over another (it's getting included as node_module dependency) and it seems you are running your server start ("react-native start") command from the library folder.

    0 讨论(0)
  • 2021-02-19 00:17

    The error you get indicates that you have two react-native dependencies. One in your main project, one in your xxx module, thus creating a conflict between their package.jsons. seems like if you install a package from a local path, it copies its node_modules directory.

    As you already have react-native as peer dependency in your custom module's package.json, try removing E:\cdg-native\CDG\node_modules\react-native-XXX\node_modules, this should solve the conflict.

    0 讨论(0)
提交回复
热议问题