RN异常:"Unable to resolve module `react-native/Libraries/vendor/emitter/EventEmitter`

本文借鉴"天蒙蒙亮"的博客https://blog.csdn.net/qq_38719039/article/details/80048049

1.基本原因:因为版本的不同使得EventEmitter层级目录发生变化,而最终导致无法找到该文件

2.解决方法步骤如下:

      a.首先先安装EventEmitter   npm install EventEmitter

      b.如果还报错的话,试着找到引用当前文件的类:

/xxx/xxx/xxx/xxx/node_modules/react-native-root-siblings/lib/AppRegistryInjection.js

      c.修改:import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter';

           i.具体修改如下

                change

                              import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter';

                        to

                             import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';

上面替换不是绝对,A改为B或者是B改为A

 

 

你可能感兴趣的:(RN异常:"Unable to resolve module `react-native/Libraries/vendor/emitter/EventEmitter`)