【发布时间】:2018-04-24 06:45:05
【问题描述】:
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 文件夹。
有没有快速解决办法?
【问题讨论】:
-
删除软件包并重新安装。 4 小时前有关于包裹的更新。修复了 package.json 文件中
dependencies应该是peerDependencies的错误