我正在尝试在我的项目中添加react-native-navigation @ v2,但这给了我这个错误。有人可以告诉我为什么会这样吗?
这是我的Package.json
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"metro-react-native-babel-transformer": "^0.53.1",
"react": "16.8.3",
"react-native": "0.59.4",
"react-native-navigation": "^2.17.0"
},
"devDependencies": {
"@babel/core": "7.4.3",
"@babel/runtime": "7.4.3",
"babel-jest": "24.7.1",
"jest": "24.7.1",
"metro-react-native-babel-preset": "0.53.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
答案 0 :(得分:0)
确保项目的根目录中有babel.config.js
文件而不是babel.rc
,并且文件babel.config.js
应该具有以下内容。
module.exports = {
presets: ["module:metro-react-native-babel-preset"]
}
希望这会有所帮助。祝您编码愉快!