我正在尝试构建一个非常简单的react本地应用程序来测试react导航。它可以正常工作,直到我安装了react导航并加载以下代码。
import { StackNavigator } from 'react-navigation';在运行时,它给我消息“无法解析来自'Users/me/Desktop/Code/flexbox/node_modules/react-navigation/src/views/Header.js'...”的模块'react/lib/ReactComponentWithPureRenderMixin‘尽管该文件实际上存在于该位置,但当我手动导航到它时。我已经尝试过清理管理员,删除/重新安装模块,并多次重置打包器缓存。有什么想法吗?下面是我的package.json。
{
"name": "flexbox",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0-alpha.6",
"react-native": "0.43.3",
"react-navigation": "^1.0.0-beta.7"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "16.0.0-alpha.6"
},
"jest": {
"preset": "react-native"
}
}发布于 2017-04-18 06:45:50
您需要将依赖关系更改为
{
"react": "16.0.0-alpha.6",
"react-native": "0.43.3",
"react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7"
}如本票证中所讨论的:https://github.com/react-community/react-navigation/issues/923
https://stackoverflow.com/questions/43463961
复制相似问题