[英]React-Native-Reanimated: error: node_modules\react-native-reanimated\src\index.ts:
I was making new project and I can't run the android emulator with this error.我正在制作新项目,但无法运行 android 模拟器并出现此错误。
It is located at 'node_modules\react-native-reanimated\src\index.ts' and this is just the code there:它位于“node_modules\react-native-reanimated\src\index.ts”,这只是那里的代码:
// tree-shaken side effects
import './reanimated2/js-reanimated/global';
// @ts-ignore backward compatibility with treeshaking
export * from './reanimated1';
export * from './reanimated2';
export * as default from './Animated';
Im not sure what to do, please help.我不确定该怎么做,请帮忙。 Thank you in advance!先感谢您!
I also search for an answer and this worked for me.我也在寻找答案,这对我有用。
Visit this expo reanimated docs link https://docs.expo.dev/versions/latest/sdk/reanimated/#installation访问此 expo 重新动画文档链接https://docs.expo.dev/versions/latest/sdk/reanimated/#installation
and I added this in my 'babel.config.js' file我在我的“babel.config.js”文件中添加了这个
module.exports = function(api) {
api.cache(true);
return {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['react-native-reanimated/plugin'],
};
};
I think the presets depends if you are using expo.我认为预设取决于您是否使用 expo。 Here is the original code given by the docs:这是文档给出的原始代码:
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['react-native-reanimated/plugin'],
};
};
you can see that I used my default preset which is module:metro.你可以看到我使用了我的默认预设,即 module:metro。
i have the same issue, This version works for me我有同样的问题,这个版本适合我
"react-native-reanimated": "2.9.1"
I ran this command expo start -c
everything was working fine.我运行了这个命令expo start -c
一切正常。 After that, I've stopped the app with Ctrl+c
and run a normal npm start
and there were no problems with it since在那之后,我用Ctrl+c
停止了应用程序并运行正常的npm start
并且没有问题,因为
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.