为什么导入expo时出现“Native module cannot be null”错误?

IT技术 ios macos reactjs react-native expo
2021-05-20 16:14:18

我正在使用:

    react-native-cli: 2.0.1
    react-native: 0.48.3
    npm: 4.6.1
    expo: 20.1.3

React Native App 是通过命令创建的: react-native init

我用过react-native linkreact-native link expo命令

问题来了,每次我像这样导入expo

    import { Permissions } from 'expo';

或者

    const Expo = require('expo');

我收到此错误: 在此处输入图片说明

顺便说一句,我正在使用 mac

1个回答

您是否在问题中查看此解决方案

https://github.com/zo0r/react-native-push-notification/issues/160

https://github.com/zo0r/react-native-push-notification/issues/279

在某些情况下重新安装 node_modules,清除所有缓存可能会有所帮助