【发布时间】:2018-12-15 01:45:35
【问题描述】:
需要帮助,我在左侧字段中遇到了一个我无法调试的奇怪错误。直到昨天我在另一台 Mac 上设置了我的 react native 项目后,这个项目才成功捆绑。
我想知道它是否来自我必须重新安装的 npm 包的版本控制。
任何方向都会有所帮助,最难的总是设置,因为你很少这样做......
我的babelrc文件如下--
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
还有我的 package.json
{
"name": "hancho_frontend",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "~27.0.0",
"react-native-scripts": "^1.14.1",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^6.2.0",
"axios": "^0.18.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-upgrade": "0.0.19",
"color": "^2.0.0",
"expo": "^27.1.0",
"hoist-non-react-statics": "^2.3.0",
"moment": "^2.22.2",
"prop-types": "^15.6.2",
"react": "^16.3.1",
"react-dom": "^16.4.1",
"react-fontawesome": "^1.6.1",
"react-native": "^0.56.0",
"react-native-dropdownalert": "^3.1.2",
"react-native-extended-stylesheet": "^0.8.0",
"react-navigation": "^2.6.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-axios-middleware": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"webpack": "^4.15.1"
}
}
我肯定安装了我没有使用的软件包,但它在过去没有造成问题。
我已经清除了缓存,卸载并重新安装了 node_modules。我还恢复到我之前工作过的早期版本的博览会。仍然没有运气。
提前致谢!
【问题讨论】:
-
我能够通过降级 react-native、webpack 和 react-navigation 的版本来捆绑它,我可能应该单独完成以找到问题的根源。如果有人能阐明如何设置这些文件以使用最新版本,那就太好了。我会更多地挖掘。
-
遇到了类似的问题,也做了一些谷歌搜索(你可以在这里看到我的完整答案:stackoverflow.com/a/51258114/8236733)。基本上,它似乎不像
react-native@0.56、react和expo的版本,需要一起工作的已经正式制定出来了(所以坚持使用react-native@ 0.55 是目前的 解决方法)。不过,需要在 GitHub (github.com/react-community/create-react-native-app) 上打开一个问题以进行确认。 -
你能发布完整的错误信息吗?我怀疑这与create-react-native-app#717有关。
标签: react-native babeljs babel-loader create-react-native-app