无法从“App.js”解析“react”(Expo CLI)

问题描述 投票:0回答:1

我最近将Expo SDK更新到37(我之前的版本是33)。自更新以来,我无法打开该应用程序,并且似乎许多模块未解析(虽然它们确实存在于我的项目文件中)。我已经清除了缓存,删除了 Node-modules 文件夹并重新安装了 Expo。什么都不起作用。我仍然收到以下错误:“无法从“App.js”解析“react”

希望有人能帮我解决这个问题!预先感谢

这是我在 App.js 中的代码:

import * as React from "react";
import { createStore } from "redux";
import { Provider } from "react-redux";
import AppNavigator from "./navigator/AppNavigator";
import { AsyncStorage } from "react-native";


console.disableYellowBox = true;


initialState.recipies = shuffleArray(initialState.recipies);
const store = createStore(reducer, initialState);

store.subscribe(() => {
  // console.log("store changed", store.getState().recipies);
});

const App = () => (
  <Provider store={store}>
    <AppNavigator />
  </Provider>
);

export default App;

enter image description here

javascript react-native expo
1个回答
0
投票

就我而言,我从expo 49升级到51,当我删除线时就解决了

"react": ["./node_modules/@types/react"] 

来自

tsconfig.json
文件

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "jsx": "react",
    "strict": true,
    "paths": {
    
      // "react": ["./node_modules/@types/react"] ---------> remove this line if exist
    },

  },

}
© www.soinside.com 2019 - 2024. All rights reserved.