gpt4 book ai didi

react-native - react native 应用程序的捆绑错误(不明确的解决方案)

转载 作者:行者123 更新时间:2023-12-03 17:35:52 25 4
gpt4 key购买 nike

Bundling `index.js`  [development, non-minified]  0.0% (0/1), failed.
error: bundling failed: ambiguous resolution: module `C:\Users\mtlok\Desktop\RN2\pep_beta\index.js` tries to require `react-native`, but there are several files providing this module. You can delete or fix them:

* `C:\Users\mtlok\Desktop\RN2\pep_beta\node_modules\react-native-responsive-dimensions\node_modules\react-native\package.json`
* `C:\Users\mtlok\Desktop\RN2\pep_beta\node_modules\react-native\package.json`

我在捆绑 react-native 应用程序时遇到此错误。

这个问题可能是由 react-native-responsive-dimensions 包引起的

这是 package.json 文件:

{
"name": "react-native-responsive-dimensions",
"version": "1.0.1",
"description": "Resposive fontSize, height and width for your react-native components.",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"test": "exit 0"
},
"keywords": [
"react-native",
"responsive",
"responsive-height",
"responsive-width",
"responsive-font-size",
"fontSize",
"responsive-dimensions"
],
"author": "DaniAkash <s.daniakash@gmail.com> (https://github.com/DaniAkash)",
"repository": "DaniAkash/react-native-responsive-dimensions",
"license": "MIT",
"dependencies": {
"react-native": "x"
}
}

此外,在 node_modules/react-native-responsive-dimensions 中有一个 node_modules 文件夹。

有快速修复方法吗?

最佳答案

试试这个命令。可能是因为缓存。

yarn start -- --reset-cache

npm start -- --reset-cache

如果它不起作用,你可以尝试 react-native-git-upgrade 或者你可以只删除 node_modules 文件夹然后运行 ​​npm install,react-原生升级 ande react-native-link

关于react-native - react native 应用程序的捆绑错误(不明确的解决方案),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47232921/

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