2017-05-11 153 views
2

我創建一個使用反應本機應用程序創建反應的原生應用程序內NPM找不到

npm create-react-native-app 

我更新的反應原生版本0.44.0,對於一些反應,本機模塊依賴其需要更新版本做出反應到16.0.0,alpha.6 這是我的package.json

{ 
    "name": "test", 
    "version": "0.1.0", 
    "private": true, 
    "devDependencies": { 
    "react-native-scripts": "0.0.29", 
    "jest-expo": "^0.4.0", 
    "react-test-renderer": "~15.5.4" 
    }, 
    "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js", 
    "scripts": { 
    "start": "react-native-scripts start", 
    "eject": "react-native-scripts eject", 
    "android": "react-native-scripts android", 
    "ios": "react-native-scripts ios", 
    "test": "node node_modules/jest/bin/jest.js --watch" 
    }, 
    "jest": { 
    "preset": "jest-expo" 
    }, 
    "dependencies": { 
    "@expo/ex-navigation": "^2.11.1", 
    "babel-preset-react-native-stage-0": "^1.0.1", 
    "expo": "^16.0.0", 
    "react": "~16.0.0-alpha.6", 
    "react-native": "0.44.0" 
    } 
} 

運行NPM安裝給了我下面的錯誤

C:\dev\repo\test>npm install 
npm WARN [email protected] requires a peer of [email protected]>=15.3.1 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]>=15.4.0 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]>=15.4.0 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed. 

看起來反應版本16.0.0-alpha.6不被loottie-react-native,react-native-maps,react-native-svg和react-static-container識別。我不確定主要版本(15)是否必須符合,或者Alpha版本16沒有被這些庫或其他內容拾取。有誰知道如何解決這一問題?謝謝。

+0

嗨hixhix,你的權利。這裏的問題是依賴衝突。地圖,svg,容器和lottie版本都取決於react @ 15的同行,而您已更新以反應原生0.44,這取決於react @ 16的同伴。您的解決方案是將所有庫升級到較新版本,並檢查它們是否更新了它們的依賴關係或降級以反應@ 15。對於我來說,在依賴關係中總是會產生這些衝突,因爲它意味着在可用時自動更新lib到更新的版本。希望這會有所幫助。 –

回答

0

我有類似的問題,實際上現在我得到這個問題,每當我嘗試創建一個新的應用程序與create-react-native-app。 唯一的解決辦法(黑客)我現在已經發現的是:

  1. 刪除node_modules(對我來說這是不夠的,只是做NPM安裝)
  2. npm install