React Native Expo在错误的位置寻找node_modules

我正在将本机应用程序重构为Expo应用程序。当我尝试从react-navigation导入<AppContainer/>时,出现以下错误:

12:00
ENOENT: no such file or directory,scandir '/Users/ayunas/Documents/lambda/RecipeShareExpo/navigation/node_modules'
ERROR
12:00
Building JavaScript bundle: error

<AppContainer/>的外观如下:

const AppNavigator = createStackNavigator({
    Home: {
        screen: Homepage
    }
})


const AppContainer = createAppContainer(AppNavigator);

export default AppContainer;

不知道为什么expo在我的导航目​​录中寻找包含导航组件的node_modules。

ufo748 回答:React Native Expo在错误的位置寻找node_modules

确保正确导入createAppContainer:

import { createAppContainer } from 'react-navigation';

如果这样做没有帮助,请尝试删除文件“ package-lock.json”和文件夹“ node_modules”,然后从项目文件夹npm installnpm install react-navigation --save运行

本文链接:https://www.f2er.com/3164634.html

大家都在问