【发布时间】:2016-03-17 18:19:14
【问题描述】:
react-bootstrap@0.26.4 依赖于 react@^0.13.3 但 react@0.14.3 被安装为依赖项。它还将 react@0.13.3 安装在 node_modules 的顶层(这很奇怪但很好)。 0.14.3 版本破坏了我的应用程序。
我希望只安装 react@0.13.3 而不是在顶层,而是在 node_modules/react-bootstrap/node_modules/react
为什么我会得到 react@0.14.3?
我也尝试在 peerDependencies 中添加 react@0.13.3,但我仍然得到 0.14.3。我也尝试过使用 npm 3,但是为我使用 npm 3 构建的应用程序做一个干净的npm install 需要 75 分钟,所以我希望有一种方法可以使用 npm 2 安装 react-bootstrap。
kullervo: ~/tmp
$ mkdir test-react-bootstrap
kullervo: ~/tmp
$ cd test-react-bootstrap
kullervo: ~/tmp/test-react-bootstrap
$ npm install react-bootstrap@0.26.4
npm WARN peerDependencies The peer dependency react@^0.13 included from react-bootstrap 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@>=0.11.0 included from uncontrollable 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@>=0.13.0 included from react-overlays 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.
react@0.13.3 node_modules/react
└── envify@3.4.0 (through@2.3.8, jstransform@10.1.0)
react-bootstrap@0.26.4 node_modules/react-bootstrap
├── classnames@2.2.1
├── keycode@2.1.0
├── dom-helpers@2.4.0
├── lodash-compat@3.10.1
├── react-prop-types@0.3.0 (warning@2.1.0)
├── babel-runtime@5.8.34 (core-js@1.2.6)
├── react@0.14.3 (envify@3.4.0, fbjs@0.3.2)
├── react-overlays@0.4.4 (react-prop-types@0.2.2, warning@2.1.0)
└── uncontrollable@3.2.0 (invariant@2.2.0)
kullervo: ~/tmp/test-react-bootstrap
$ grep version node_modules/react-bootstrap/package.json | head -n 1
"version": "0.26.4",
kullervo: ~/tmp/test-react-bootstrap
$ grep version node_modules/react-bootstrap/node_modules/react/package.json | head -n 1
"version": "0.14.3",
kullervo: ~/tmp/test-react-bootstrap
$ grep version node_modules/react/package.json | head -n 1
"version": "0.13.3",
kullervo: ~/tmp/test-react-bootstrap
$ node -v
v0.12.9
kullervo: ~/tmp/test-react-bootstrap
$ npm -v
2.14.9
【问题讨论】: