升级后,版本停留在16.3.2

时间:2019-02-14 21:34:06

标签: reactjs npm

我已经做出了反应16.3.2,今天我尝试通过yarn upgrade react@latest对其进行升级,它已经升级了yarn.lock的react@^16.8.2,但是当我console.log它仍然输出16.3.2的反应版本。我错过了什么吗?

这是我的package.json

    {
        "name": "client",
        "version": "1.0.0",
        "description": "",
        "main": "index.js",
        "scripts": {
            "tj": "jest",
            "test": "yarn jest --watch",
            "coverage": "yarn jest --coverage || true",
            "test:watch": "npm test -- --watch",
            "start": "NODE_ENV=dev node server.js",
            "startw": "NODE_ENV=dev nodemon --watch webpack.config.js  server.js"
        },
        "jest": {
            "setupTestFrameworkScriptFile": "./config/testSetupV1.js",
            "setupFiles": [
                "raf/polyfill"
            ],
            "moduleNameMapper": {
                "\\.(css)$": "<rootDir>/node_modules/jest-css-modules",
                "\\.(scss)$": "<rootDir>/node_modules/jest-css-modules",
                "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js"
            },
            "globals": {
                "__TEST__": true
            }
        },
        "author": "",
        "license": "ISC",
        "devDependencies": {
            "@babel/core": "^7.1.6",
            "@babel/plugin-proposal-class-properties": "^7.0.0-beta.42",
            "@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.42",
            "@babel/plugin-syntax-dynamic-import": "^7.0.0",
            "@babel/preset-env": "^7.0.0-beta.42",
            "@babel/preset-flow": "^7.0.0-beta.42",
            "@babel/preset-react": "^7.0.0-beta.42",
            "@babel/preset-stage-0": "^7.0.0-beta.42",
            "@loadable/component": "^5.1.2",
            "@welldone-software/why-did-you-render": "^2.3.2",
            "babel-core": "^7.0.0-bridge.0",
            "babel-eslint": "^8.2.1",
            "babel-jest": "^23.6.0",
            "babel-loader": "^8.0.0-beta.2",
            "babel-plugin-react-hot": "^1.0.4",
            "babel-plugin-transform-export-extensions": "^6.22.0",
            "babel-plugin-transform-flow-strip-types": "^6.22.0",
            "babel-polyfill": "^6.23.0",
            "babel-register": "^6.23.0",
            "clean-webpack-plugin": "^1.0.0",
            "css-loader": "^0.28.11",
            "enzyme": "^3.3.0",
            "enzyme-adapter-react-16": "^1.0.4",
            "enzyme-to-json": "^3.2.2",
            "eslint": "^4.15.0",
            "eslint-config-airbnb": "^16.1.0",
            "eslint-loader": "^1.9.0",
            "eslint-plugin-flowtype": "^2.41.0",
            "eslint-plugin-flowtype-errors": "^3.5.1",
            "eslint-plugin-import": "^2.8.0",
            "eslint-plugin-jsx-a11y": "^6.0.3",
            "eslint-plugin-prettier": "^2.4.0",
            "eslint-plugin-react": "^7.5.1",
            "eslint_d": "^5.3.0",
            "expect": "^1.16.0",
            "extract-text-webpack-plugin": "^3.0.0",
            "flow-bin": "^0.71.0",
            "happypack": "^3.0.3",
            "jest": "^23.6.0",
            "jest-cli": "^23.6.0",
            "jest-css-modules": "^1.1.0",
            "jsdom": "^8.2.0",
            "mocha": "^2.4.5",
            "mocha-jsdom": "^1.1.0",
            "node-sass": "^4.9.4",
            "npm-check-updates": "^2.8.9",
            "npm-install-webpack-plugin": "^4.0.4",
            "postcss-global-import": "^1.0.1",
            "postcss-loader": "^2.1.3",
            "prettier-eslint": "^8.7.1",
            "prettier-eslint-cli": "^4.7.0",
            "raf": "^3.4.0",
            "react-addons-test-utils": "^15.1.0",
            "react-dev-utils": "^4.1.0",
            "react-hot-loader": "^4.5.3",
            "react-render-visualizer": "^0.2.2",
            "react-testing-library": "5.2.3",
            "redux-devtools": "^3.4.2",
            "redux-devtools-chart-monitor": "^1.6.1",
            "redux-devtools-dock-monitor": "^1.1.3",
            "redux-devtools-log-monitor": "^1.0.11",
            "redux-slider-monitor": "^2.0.0-1",
            "sass-loader": "^6.0.7",
            "sinon": "^1.17.3",
            "style-loader": "^0.13.1",
            "webpack": "^4.5.0",
            "webpack-assets-manifest": "^3.1.1",
            "webpack-bundle-analyzer": "^2.9.0",
            "webpack-cli": "^3.1.2",
            "webpack-dev-server": "^3.1.4",
            "webpack-notifier": "^1.5.0",
            "why-did-you-update": "^1.0.6"
        },
        "dependencies": {
            "Faker": "^0.7.2",
            "annyang": "^2.6.0",
            "aphrodite": "^1.1.0",
            "axios": "^0.16.1",
            "chrono": "^1.0.5",
            "chrono-node": "^1.2.5",
            "classnames": "^2.2.5",
            "color": "^0.11.3",
            "counterpart": "^0.17.4",
            "cuid": "^1.3.8",
            "damals": "^0.9.4",
            "date-fns": "^1.28.0",
            "delay": "^1.3.1",
            "draft-js": "^0.7.0",
            "draft-js-export-html": "^0.3.0",
            "fast-memoize": "^2.5.1",
            "fecha": "^2.1.0",
            "file-loader": "^0.8.5",
            "flow-typed": "^2.4.0",
            "focus-trap-react": "^3.1.2",
            "folktale": "^2.0.1",
            "friendly-truncate": "^1.0.3",
            "futils": "^3.0.1",
            "glamor": "^2.20.40",
            "glamorous": "^4.11.0",
            "hh-mm-ss": "^1.1.0",
            "history": "^2.0.1",
            "hms-time": "^0.1.1",
            "humanize-plus": "^1.8.2",
            "install": "^0.12.2",
            "interact.js": "^1.2.8",
            "intl": "^1.1.0",
            "jason-form": "^0.0.3",
            "lodash": "^4.13.1",
            "memoizee": "^0.3.10",
            "moment": "^2.17.1",
            "node-quickbooks": "^2.0.20",
            "normalizr": "^2.1.0",
            "object-to-formdata": "^1.5.2",
            "parse-address": "^0.0.10",
            "password-generator": "^2.2.0",
            "pluralize": "^3.0.0",
            "postcss": "^5.2.17",
            "postcss-cssnext": "^2.10.0",
            "postcss-import": "^9.1.0",
            "prop-types": "^15.5.10",
            "pubnub": "^4.13.0",
            "query-string": "^4.2.2",
            "query-string-parser": "^0.1.4",
            "ramda": "^0.25.0",
            "ramda-adjunct": "^2.10.0",
            "ramda-fantasy": "^0.8.0",
            "react": "^16.8.2",
            "react-addons-shallow-compare": "^15.1.0",
            "react-addons-text-content": "^0.0.4",
            "react-calendar-timeline": "^0.11.1",
            "react-dnd": "^2.1.4",
            "react-dnd-html5-backend": "^2.1.2",
            "react-dom": "^16.8.2",
            "react-dropzone": "^4.2.9",
            "react-floating-label": "^1.0.0",
            "react-fontawesome": "1.6.1",
            "react-functional": "^1.2.0",
            "react-grid-layout": "^0.16.0",
            "react-hotkeys": "^0.10.0",
            "react-idle": "^3.0.0",
            "react-is": "^16.8.2",
            "react-json-pretty": "^1.7.9",
            "react-loadable": "^5.3.1",
            "react-loadable-visibility": "^2.5.0",
            "react-modal": "^3.1.0",
            "react-player": "^0.25.0",
            "react-quill": "^1.1.0",
            "react-redux": "^4.4.5",
            "react-resizable": "^1.7.1",
            "react-router": "^3.0.0-beta.1",
            "react-router-redux": "^4.0.0",
            "react-rte": "^0.15.0",
            "react-select": "^2.0.0-beta.7",
            "react-spinners": "^0.1.5",
            "react-stateful-fn": "^0.1.0",
            "react-stateless": "^0.2.1",
            "react-sticky": "^6.0.3",
            "react-stripe-checkout": "^2.6.3",
            "react-test-renderer": "^16.1.0",
            "react-tiny-virtual-list": "^2.1.2",
            "react-toastify": "^2.0.0",
            "react-toolbox": "^2.0.0-beta.8",
            "react-visibility-sensor": "^5.0.2",
            "recharts": "^1.0.1",
            "recompose": "^0.27.0",
            "reduce-reducers": "^0.1.2",
            "redux": "^3.5.2",
            "redux-crud": "^3.2.0",
            "redux-form": "^7.4.2",
            "redux-mock-store": "^1.5.3",
            "redux-saga": "^0.16.0",
            "reselect": "^4.0.0",
            "seamless-immutable": "^7.0.0",
            "store2": "^2.7.0",
            "url-loader": "^0.5.7"
        }
    }

谢谢!

1 个答案:

答案 0 :(得分:0)

yarn upgrade不会更新package.json,只会更新锁定文件。实际上,yarn upgrade标志都没有。 here

中对此进行了长时间的讨论

您可以执行以下操作:

  • 使用yarn add react@latest重新安装React
  • 安装npm软件包以检查更新,例如npm-check-updates。运行它来更新package.json,然后尝试yarn install
  • 或者您可以安装特定的React版本yarn upgrade react@16.8.2

这是预期的行为,即使它在docs中非常令人困惑。