【问题标题】:ERROR Cannot read properties of undefined (reading 'configurations'). TypeError: Cannot read properties of undefined (reading 'configurations')错误无法读取未定义的属性(读取“配置”)。 TypeError:无法读取未定义的属性(读取“配置”)
【发布时间】:2022-07-06 19:14:23
【问题描述】:

我在我的 react-native 项目中安装了@react-native-community/cli-platform-android,现在我收到“错误无法读取未定义的属性(读取'配置')。 TypeError: Cannot read properties of undefined (reading 'configurations')" on running npm run android.

【问题讨论】:

  • 这个运气好吗?我今天刚遇到同样的事情。
  • 我有同样的问题,我使用命令 react-native init 创建新的和新鲜的 react native 项目,但是当我运行项目时出现错误。
  • 这个有什么更新吗?就在上面,我从一个新的 react native 项目中得到了这个。

标签: javascript android reactjs react-native typeerror


【解决方案1】:

如果您在 react native v0.68.2 上遇到问题, 您应该更改以下文件:

node_modules/@react-native-community/cli-platform-ios/build/config/index.js

(对我来说是第 102 行)。

function dependencyConfig(folder, userConfig) {
// const configurations = userConfig.configurations || [];
    let configurations="";

这修复了由于 userConfig 为空而导致的崩溃(不确定是错误还是错误配置)

然后正常运行react-native run-android

【讨论】:

    猜你喜欢
    • 2022-07-12
    • 2022-01-05
    • 2022-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 2022-12-24
    • 2023-02-26
    • 2019-02-20
    相关资源
    最近更新 更多