ant-design / ant-design-mobile

Essential UI blocks for building mobile web apps.
https://mobile.ant.design
MIT License
11.65k stars 2.4k forks source link

how to fix peerDependencies react peerinvalid #1188

Closed huyansheng3 closed 7 years ago

huyansheng3 commented 7 years ago

Version

undefined

Environment

macos chrome "react": "^15.3.0",

Reproduction link

http://github.com

Steps to reproduce

npm i ant-mobile --save

What is expected?

安装成功

What is actually happening?

npm WARN package.json fe@1.0.0 No description npm WARN package.json fe@1.0.0 No repository field. npm WARN package.json fe@1.0.0 No README data npm WARN peerDependencies The peer dependency react-native@>=0.20.0 included from react-native-scrollable-tab-view will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3 . Your application will need to depend on it explicitly. npm WARN peerDependencies The peer dependency react@16.0.0-alpha.6 included from react-native will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3 . Your application will need to depend on it explicitly. npm WARN deprecated node-uuid@1.4.7: Use uuid module instead npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "antd-mobile" "--save" npm ERR! node v7.0.0 npm ERR! npm v2.15.11 npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react@16.0.0-alpha.6 does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer nuka-carousel@2.0.4 wants react@^0.14.8 || ^15.0.1 npm ERR! peerinvalid Peer react-hammerjs@0.5.0 wants react@^0.14.3 || ^15.0.0 npm ERR! peerinvalid Peer react-native@0.43.3 wants react@16.0.0-alpha.6

npm ERR! Please include the following file with any support request: npm ERR! /Users/MacBook/Documents/2016/hunter/npm-debug.log


提示安装失败,看起来是 react 是这几个插件依赖的 react 版本不一致导致的,但依赖到16.0.0要怎么搞

paranoidjk commented 7 years ago

暂时先使用react 15?

huyansheng3 commented 7 years ago

@paranoidjk 改成 react 15也会有问题吧,主要 antd-mobile 依赖了 react-native, react-native 设置了 deeperDependency 依赖react 版本为16-alpha.6,无法安装了。 我升到react@16.0.0-alpha.6倒有可能解决,但这明显太坑了。

paranoidjk commented 7 years ago

antd-mobile 依赖的 react-native 一直没升级,不会依赖react16的 https://github.com/ant-design/ant-design-mobile/blob/master/package.json#L113

huyansheng3 commented 7 years ago

我本地的 npm v4.7.3, node 2.15.11

afc163 commented 7 years ago

写反了吧。你应该把 npm 升级到 4+ 。

huyansheng3 commented 7 years ago

@afc163 OK,确实写反了。。囧 不过文档里仅要求了 node v4.x 呀https://mobile.ant.design/docs/react/getting-started

huyansheng3 commented 7 years ago

1.将 "antd-mobile": "~1.0.8", 手工写入 package.json 2.rm -r node_modules/

  1. npm i
  2. 搞定! 感谢! @afc163
paranoidjk commented 7 years ago

@huyansheng3 建议解决问题后自己关issue,你写的并没有什么实质信息,无非是确保最新版的 antd-mobile 并重装了 node_modules 而已。