React app throwing error: Uncaught TypeError: Cannot read property 'shape' of undefined

React app throwing error: Uncaught TypeError: Cannot read property 'shape' of undefined

相关行在 bundle.js 中:

exports["default"] = _react.PropTypes.shape({
      subscribe: _react.PropTypes.func.isRequired,
      dispatch: _react.PropTypes.func.isRequired,
      getState: _react.PropTypes.func.isRequired
    });

我刚刚升级到 React 16,并已按照此 tutorial 调整 PropTypes。我只有一个引用道具类型的组件,像这样:

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';

export default function (ComposedComponent) {
    class Authentication extends Component {
        static contextTypes = {
            router: PropTypes.object
        }

我做错了什么?

编辑:这是我的依赖项:

"devDependencies": {
    "chai": "^3.5.0",
    "chai-jquery": "^2.0.0",
    "css-loader": "^0.28.7",
    "ignore-styles": "^5.0.1",
    "jquery": "^2.2.1",
    "jsdom": "^8.1.0",
    "loaders": "^1.1.3",
    "mocha": "^2.4.5",
    "node-sass": "^4.5.3",
    "prop-types": "^15.6.0",
    "react-addons-test-utils": "^0.14.7",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.18.2",
    "webpack": "^1.12.9",
    "webpack-dev-server": "^1.14.0"
  },
  "dependencies": {
    "axios": "^0.16.2",
    "babel-core": "^6.2.1",
    "babel-loader": "^6.2.0",
    "babel-preset-env": "^1.6.0",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-1": "^6.1.18",
    "lodash": "^3.10.1",
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-redux": "^5.0.6",
    "react-router": "^4.2.0",
    "react-router-dom": "^4.2.2",
    "react-spinkit": "^3.0.0",
    "redux": "^3.0.4",
    "redux-form": "^7.0.4",
    "redux-thunk": "^2.2.0",
    "webpack": "^3.8.1"
  }

编辑 2:即使我注释掉这一行,也会出现同样的错误。但是这一行是我在整个项目中唯一提到 prop types 的地方。给出了什么?

static contextTypes = {
            router: PropTypes.object
        }

react-spinkit 的当前版本还没有为 React 16.0 做好准备,因为它仍然使用现在不受支持的 React.PropTypes:

Relevant code on GitHub

最后一次提交是在 5 月 22 日。恐怕您现在无法升级 React。但看起来当前代码已经是两者的混合,只有一行需要更改,因此您可以向他们提交包含该更改的拉取请求。