我對React有點新鮮,這是我的第一個項目,但花了相當一段時間學習和編寫反應原生代碼。「試圖構建時無法解析'.../react-konva/src/react-konva.js'模塊'react/lib/React'」錯誤
我想我有針腳爲什麼我得到的錯誤,但我不知道如何解決它。
我想要做的是安裝並運行react-konva,一個使用Konva.js在我的應用程序中高效顯示Canvas元素的畫布元素庫。在運行yarn add konva react-konva --save
(已經有反應)後,我遇到了依賴性問題,其中react-konva需要[email protected]
,但我的項目的其他部分需要[email protected]
。從而導致問題。任何有關它發生的原因(如果我不正確)或如何解決這個問題將是驚人的。
an npm list --depth=0
of my project to show the dependencies.
的Package.json
:
{
"name": "amazingProject",
"version": "0.0.1",
"private": true,
"main": "node_modules\\expo\\AppEntry.js",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"konva": "^1.6.7",
"prop-types": "^15.5.10",
"react-addons-shallow-compare": "^15.6.0",
"react-konva": "^1.1.4",
"react-native": "0.45.1",
"react-native-cli": "^2.0.1",
"react-native-lightbox": "^0.6.0",
"react-native-modal-dropdown": "^0.4.4",
"react-native-side-menu": "^0.20.3",
"react-native-slider": "0.10.0",
"react-native-vector-icons": "^4.2.0",
"react-navigation": "1.0.0-beta.11",
"style-equal": "^1.0.0",
"watchman": "^0.1.8",
"yarn": "^0.27.5"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.0.0",
"jest": "20.0.4",
"react": "16.0.0-alpha.12",
"react-dom": "16.0.0-alpha.12",
"react-test-renderer": "16.0.0-alpha.12"
},
"peerDependencies": {
"react": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
是否反應,konva已經在您的節點模塊文件夾存在嗎? –
它沒有存在,實際上我重新制作了這個項目並運行了紗線來創建一個新的'node_modules'。 –
我也試過npm install react konva react-konva --save。剛試過'npm install'而不是'yarn'。然後運行'react-native run-android',它給了我'UnableToResolveError undefined',然後發生了同樣的錯誤,因爲我在重新加載時已經截圖了,而這正是之前的樣子。 –