NPM 2安装的错误版本

时间:2015-12-11 18:32:38

标签: node.js npm

react-bootstrap@0.26.4取决于react@^0.13.3但是react@0.14.3作为依赖项安装。它还在node_modules的顶层安装react@0.13.3(这很奇怪但很好)。 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构建的app做一个干净的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

1 个答案:

答案 0 :(得分:0)

好像npm 2似乎很简单。通过升级我的所有应用程序的deps,我能够使用最新版本的节点和npm,突然性能很好。案件结案。获得的经验:不要使用npm 2。