我正在制作一个应用程序,在反应本土博览会。它在网络浏览器上运行,但不能在android模拟器上运行,或者在我的手机上运行expo应用程序。我有两个错误:-
错误:要求模块"node_modules\react-native-reanimated\src\Animated.js",抛出一个异常: Error: Reactive2未能创建一个worklet,也许您忘记添加?
不变违规:"main“未注册。在以下情况下可能发生这种情况:
如能提供任何帮助,将不胜感激。
我的博览会sdk : 44,
我的package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-community/masked-view": "^0.1.10",
"axios": "^0.24.0",
"expo": "^44.0.0",
"expo-status-bar": "~1.2.0",
"ngrok": "^4.2.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-navigation-tabs": "^2.11.0",
"react-native-maps": "0.29.4"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}我的babel.config
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: ["react-native-reanimated/plugin"],
};
};发布于 2022-01-03 07:42:25
正如reanimated 文档中提到的,
yarn add react-native-reanimated@nextmodule.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['react-native-reanimated/plugin'],
};
};expo start --clear这应该能解决问题!
发布于 2021-12-27 22:34:21
我以前也犯过同样的错误,我做了两件事:
yarn add react-native-reanimated@next,实际安装了react本机-恢复。expo update并按y键获取兼容版本上的每个模块,确保我的博览会中的所有内容都是最新的。发布于 2021-12-31 07:42:01
https://stackoverflow.com/questions/70493915
复制相似问题