在运行react-native init reactApp后,我收到警告npm WARN react-native@0.39.2需要一个react @〜15.4.0-rc.4的对等,但没有安装.虽然构建是成功的,但在构建之后这是我的package.json.
{
"name": "reactApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.1",
"react-native": "0.39.2"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "18.0.0",
"react-test-renderer": "15.4.1"
},
"jest": {
"preset": "react-native"
}
}
这是一个问题吗?我应该更改反应版本然后运行npm install吗?我完全是新的反应/反应原生,所以任何建议都会被赞赏,以防止将来出现错误的最佳做法.
谢谢!
最佳答案 我已经和React Native一起工作了3个星期.在运行react-native init Proj时,我有类似的警告:
npm WARN react-native@0.39.2 requires a peer of react@~15.4.0-rc.4 but none was installed.
并且
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN prefer global marked@0.3.6 should be installed with -g
但是,它并没有影响我的工作.编写代码并运行代码时,我没有遇到任何问题.
你总是可以运行:
npm install –save react@15.4并且它应该修复它但你的版本目前是最新版本所以我不会这样做.