加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

react-native – 创建React Native App. – 插件/预设文件不允许

发布时间:2020-12-15 20:33:44 所属栏目:百科 来源:网络整理
导读:需要一些帮助,我从左侧字段中得到一个奇怪的错误,我无法调试.在我在另一台Mac上设置我的react本机项目后,这个项目成功捆绑到昨天. 我想知道它是否来自npm软件包的版本我必须重新安装. 任何方向都会有所帮助,它始终是最难设置的,因为你很少这么做… 我的babel
需要一些帮助,我从左侧字段中得到一个奇怪的错误,我无法调试.在我在另一台Mac上设置我的react本机项目后,这个项目成功捆绑到昨天.

我想知道它是否来自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.我还回到了之前我曾经工作过的早期版本的世博会.仍然没有运气.

提前致谢!

解决方法

create-react-native-app使用Expo,截至当前版本(SDK v29)不支持React Native 0.56.其 release announcement解释了原因:

We did not update to React Native 0.56.0 for this release for two reasons. First,and most notably,in React Native 0.56.0 babel was updated to 7.0.0-beta.47 from ^6.24.1. Previous experiences with babel updates have shown us that they can been frustrating and time consuming for developers who just want to ship their app and minimize the time spent on infrastructure thrashing,so we wanted to give this more time to stabilize.

Second,0.56.0 introduces some bugs and doesn’t include enough useful features and fixes over 0.55.4 to justify the tradeoff of updating babel.

如果您确实想使用RN 0.56,并且不需要使用Expo,则可以通过在项目中运行npm run eject来消除依赖关系.在加载应用程序时,您仍会收到类似的错误消息,但是由于弹出时引入了不同的依赖关系.要解决这个问题,请安装babel-preset-react-native @ 5,并在项目的.babelrc文件中将“babel-preset-react-native-stage-0 / decorator-support”替换为“babel-preset-react-native”. (请注意,运行eject命令后.babelrc看起来会有所不同.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读