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