无法升级到React-Bootstrap最新版本

时间:2018-09-12 10:56:59

标签: javascript reactjs npm jestjs react-bootstrap

当我这样做时,我在升级到最新版本的react-bootstrap时遇到问题

npm install --save react-bootstrap

它打印:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN eslint-config-react-app@0.2.1 requires a peer of babel-eslint@6.1.2 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@0.2.1 requires a peer of eslint@3.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@0.2.1 requires a peer of eslint-plugin flowtype@2.18.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@0.2.1 requires a peer of eslint-plugin-import@1.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@0.2.1 requires a peer of eslint-plugin-jsx-a11y@2.2.2 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@0.2.1 requires a peer of eslint-plugin-react@6.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-addons-test-utils@15.6.2 requires a peer of react-dom@^15.4.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-bootstrap-typeahead@1.4.2 requires a peer of react@^0.14.0 || ^15.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-bootstrap-typeahead@1.4.2 requires a peer of react-dom@^0.14.0 || ^15.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-dev-utils@0.2.1 requires a peer of webpack@^1.13.2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.14 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ react-bootstrap@0.30.10
updated 1 package and audited 29067 packages in 20.627s
found 275 vulnerabilities (163 low, 77 moderate, 33 high, 2 critical) run `npm audit fix` to fix them, or `npm audit` for details

因此而不是更新到0.32.4版本,而是保持在0.30.10

该如何解决? 我的测试(使用Jest)失败了,原因可能是因为并非所有依赖项都已更新为最新版本。尽我所能进行更新,但是现在我必须更新react-bootstrap。

package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-jest": "^23.6.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "enzyme": "^3.6.0",
    "jest": "^23.6.0",
    "react-addons-test-utils": "^15.6.2",
    "react-dom": "^16.5.0",
    "react-scripts": "^0.6.1",
    "react-test-renderer": "^16.5.0"
  },
  "dependencies": {
    "adal-angular": "^1.0.17",
    "axios": "^0.15.3",
    "bootstrap": "^3.3.7",
    "jquery": "^3.3.1",
    "lodash": "^4.17.10",
    "prop-types": "^15.6.2",
    "react": "^16.5.0",
    "react-bootstrap": "^0.30.10",
    "react-bootstrap-typeahead": "^1.4.2",
    "react-http-request": "^1.0.4",
    "react-overlays": "^0.8.3",
    "react-router-dom": "^4.3.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "jest",
    "eject": "react-scripts eject"
  },
  "description": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).",
  "main": "index.js",
  "author": "",
  "license": "ISC",
  "jest": {
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
      "\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
    }
  }
}

3 个答案:

答案 0 :(得分:2)

尝试

npm install --save react-bootstrap@0.32.4

yarn add react-bootstrap@0.32.4

答案 1 :(得分:0)

即使您可以使用latest而不是指定任何版本,也可以将任何软件包更新到最新版本。

npm install --save react-bootstrap@latest

答案 2 :(得分:0)

原因来自package.json文件,尤其是来自插入符号。例如:

^0.2.3 means 0.2.3 <= v < 0.3.

所以在您的情况下:

^0.30.10 means 0.30.10 <= v < 0.31

要升级到最新的软件包,请从依赖项中删除该行,然后重新运行命令(npm install --save react-bootstrap