我对React有点新手,这是我的第一个项目,但花了很多时间学习和编写反应原生代码。
我想我已经指出为什么我收到错误,但我不知道如何解决它。
我要做的是安装并运行react-konva,一个使用Konva.js在我的应用中有效显示Canvas元素的canvas元素库。在运行yarn add konva react-konva --save
(已经做出反应)之后,我遇到了依赖性问题,其中react-konva需要react@15.6.1
,但我项目的其他部分需要react@16.0.0-alpha.12
。从而引起问题。任何关于它为什么发生(如果我不对)或如何解决这个问题的见解将是惊人的。
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"
}
}
答案 0 :(得分:1)
react-konva
尚未支持新的反应v16。
您可以尝试使用v15.6.1
反应。或者等待react-konva
的更新: