简体   繁体   中英

Cannot upgrade to React-Bootstrap latest version

I'm having an issue with upgrading to the latest version of react-bootstrap, when I do

npm install --save react-bootstrap

It prints:

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

So instead of updating to version 0.32.4, is stays with 0.30.10

What should I do in order to fix it ? My test (with Jest) fails and the reason might be because not all dependencies are updated to the latest version. In updates as much as I could but now I must update 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"
    }
  }
}

Try

npm install --save react-bootstrap@0.32.4

or

yarn add react-bootstrap@0.32.4

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

npm install --save react-bootstrap@latest

The reason comes from the package.json file, especially from the caret. For example :

^0.2.3 means 0.2.3 <= v < 0.3.

So in your case :

^0.30.10 means 0.30.10 <= v < 0.31

To upgrade to the latest package, delete the line from your dependency and re-run your command ( npm install --save react-bootstrap )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM