gpt4 book ai didi

ios - React native 升级 - pod install 为 config = use_native_modules 抛出错误

转载 作者:行者123 更新时间:2023-12-05 04:29:04 29 4
gpt4 key购买 nike

我正在尝试将我的 React native 版本从 0.66.3 升级到 0.68.2。

我关注了this .

如果我尝试运行 pod install,它会抛出:

error Cannot read properties of undefined (reading 'configurations').

[!] Invalid `Podfile` file: 859: unexpected token at 'TypeError: Cannot read properties of undefined (reading 'configurations')

info Run CLI with --verbose flag for more details.
'.

# from /Users/me/Documents/app/ios/Podfile:8
# -------------------------------------------
# target 'app' do
> config = use_native_modules!
# # Flags change depending on the env values.

这是我的 package.json:

{
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {
"format": "yarn prettier -c '**/*.+(js|json|ts|tsx|md)'",
"format:fix": "yarn prettier --write '**/*.+(js|json|ts|tsx|md)'",
"typecheck": "tsc --noEmit",
"commit": "git-cz",
"generateTypes": "graphql-codegen",
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest --runInBand --detectOpenHandles --forceExit",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@apollo/client": "^3.6.5",
"apollo-upload-client": "^17.0.0",
"date-fns": "^2.28.0",
"eventemitter3": "^4.0.7",
"graphql": "^16.5.0",
"i18next": "^21.8.5",
"react": "18.1.0",
"react-i18next": "^11.16.9",
"react-native": "0.68.2",
"react-native-encrypted-storage": "^4.0.2",
"react-native-fast-image": "^8.5.11",
"react-native-get-random-values": "^1.8.0",
"react-native-image-picker": "^4.8.3",
"react-native-keychain": "^8.0.0",
"react-native-notification-sounds": "^0.5.4",
"react-native-sound": "^0.11.2",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^12.3.0",
"react-native-vector-icons": "^9.1.0",
"react-redux": "^8.0.2",
"react-router-native": "^5.3.2",
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"uuid": "^8.3.2",
"victory-native": "^36.4.1"
},
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@babel/runtime": "^7.18.3",
"@graphql-codegen/add": "3.1.1",
"@graphql-codegen/cli": "2.6.2",
"@graphql-codegen/import-types-preset": "2.1.18",
"@graphql-codegen/typescript": "2.4.11",
"@graphql-codegen/typescript-operations": "2.4.0",
"@graphql-codegen/typescript-react-apollo": "3.2.14",
"@react-native-community/cli": "^8.0.2",
"@react-native-community/eslint-config": "^3.0.2",
"@testing-library/jest-native": "^4.0.5",
"@testing-library/react-native": "^9.1.0",
"@types/apollo-upload-client": "^17.0.0",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.36",
"@types/react": "^18.0.9",
"@types/react-native": "^0.67.7",
"@types/react-native-vector-icons": "^6.4.10",
"@types/react-redux": "^7.1.24",
"@types/react-router-native": "^5.1.3",
"@types/react-test-renderer": "^18.0.0",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"babel-jest": "^28.1.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.5.0",
"eslint-plugin-react-native": "^4.0.0",
"flow-bin": "^0.179.0",
"husky": "^8.0.1",
"jest": "^28.1.0",
"lint-staged": ">=12",
"metro-react-native-babel-preset": "^0.71.0",
"mockdate": "^3.0.5",
"react-native-eject": "^0.1.2",
"react-test-renderer": "18.1.0",
"redux-devtools-extension": "^2.13.9",
"ts-jest": "^28.0.3",
"typescript": "^4.7.2"
},
"resolutions": {
"@types/react": "18.x.x",
"@types/react-dom": "18.x.x"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
}
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}

在 M1 上运行,按照说明如何使用 m1 安装 pod,同样的问题。

只是为了确认它与 0.68.2 完美配合。

问题是什么?

最佳答案

在你的开发依赖中你有:

    "@react-native-community/cli": "^8.0.2",

版本 8 与 React Native 0.68 不兼容,如果查看此版本的 package.json,可以看到 cli 版本为 ^7。

您可以将其作为直接依赖项删除(可能是最好的),或者更改您的 React Native CLI 版本以匹配 package.json 中的预期版本(撰写本文时为 7.0.3,但您始终可以 check the actual file )

关于ios - React native 升级 - pod install 为 config = use_native_modules 抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72436429/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com