2017-11-10 141 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