无法解析模块react/jsx-runtime

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

enter image description here

“依赖关系”:{ “@react-native-community/masked-view”:“0.1.10”, "@react-navigation/native": "^5.8.10", "@react-navigation/stack": "^5.12.8", "博览会": "^44.0.1", "expo-status-bar": "~1.2.0", “反应”:“^16.13.1”, “反应-dom”:“16.13.1”, "react-native": "^0.64.3", "react-native-gesture-handler": "~2.1.0", "react-native-paper": "^4.11.1", "react-native-reanimated": "~2.3.1", "react-native-safe-area-context": "3.3.2", "react-native-screens": "~3.10.1", "react-native-status-bar-height": "^2.6.0", “react-native-web”:“~0.13.12” },

react-native node-modules
3个回答
9
投票

React 17 引入了一个新功能

New JSX Transform
。简而言之,
JSX Transform
可以让你写出
react
而无需
import React from 'react'
。不过,新功能是在 React 17 中引入的,并支持 React 16.14.0、React 15.7.0。
"react": "^16.13.1"
不兼容新功能,所以你应该升级你的react版本。

参考
  1. 介绍新的 JSX 转换

1
投票

更新您的 React 版本可能可以解决您的问题。

命令行:

npm install --save react@latest


0
投票

尝试删除所有这些文件:

  • 节点模块
  • package-lock.json
  • ios/Pods
  • ios/Podfile.lock
  • ios/构建

然后运行:

npm start --reset-cache

最后:

npx react-native run-ios
© www.soinside.com 2019 - 2024. All rights reserved.