2017-11-10 131 views
1
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` 

当绑定反应本机应用程序时,我得到此错误。反应本机应用程序绑定错误(ambigous分辨率)

此问题可以通过本反应天然响应维度包

这里所引起的是的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 <[email protected]> (https://github.com/DaniAkash)", 
    "repository": "DaniAkash/react-native-responsive-dimensions", 
    "license": "MIT", 
    "dependencies": { 
    "react-native": "x" 
    } 
} 

另外,存在位于内部node_modules /反应的node_modules夹-native响应维度。

是否有快速修复?

+0

删除软件包并重新安装。 4小时前有关该软件包的更新。修正了package.json文件中的'dependencies'应该是'peerDependencies'的错误 – bennygenel

回答

2

试试这个命令。也许这是因为缓存。

yarn start -- --reset-cache 

npm start -- --reset-cache 

,如果它不工作,你可以尝试react-native-git-upgrade或者你可以直接删除文件夹node_modules然后运行npm installreact-native upgrade安德react-native-link