npm WARN EPEERINVALID react-bootstrap-daterangepicker@1.0.6需要jquery@^1.11.3的对等,但没有安装

时间:2015-12-04 20:48:16

标签: jquery twitter-bootstrap reactjs npm webpack

我正在尝试构建react.js和webpack项目。

当我进入项目目录并执行npm install时,我收到此警告

npm WARN EPEERINVALID react-bootstrap-daterangepicker@1.0.6 
requires a peer of jquery@^1.11.3 but none was installed.

在package.json中我可以看到已定义了jquery。

{
  "myapp": {
    "name": "foo",
    "rootPath": "./dist",
    "proxies": [
      {
        "from": "/bar",
        "to": "http://server"
      }
    ]
  },
  "private": true,
  "scripts": {
    "test": "mocha --compilers js:babel-core/register,jsx:test/compiler.js --require ./test/test_helper.js 'test/**/*.@(js|jsx)'",
    "test:watch": "npm run test -- --watch"
  },
  "version": "0.0.1-SNAPSHOT",
  "devDependencies": {
    "babel-core": "^5.8.25",
    "babel-eslint": "^4.1.3",
    "babel-loader": "^5.3.2",
    "chai": "^3.4.1",
    "chai-immutable": "^1.5.2",
    "css-loader": "^0.19.0",
    "eslint": "^1.6.0",
    "eslint-config-airbnb": "^0.1.0",
    "eslint-loader": "^1.0.0",
    "eslint-plugin-react": "^3.5.1",
    "file-loader": "^0.8.4",
    "html-webpack-plugin": "^1.6.2",
    "imports-loader": "^0.6.5",
    "jsdom": "^7.0.2",
    "mocha": "^2.3.4",
    "node-sass": "^3.3.3",
    "react-addons-test-utils": "^0.14.2",
    "react-hot-loader": "^1.3.0",
    "redux-devtools": "^2.1.5",
    "sass-loader": "^3.0.0",
    "style-loader": "^0.12.4",
    "url-loader": "^0.5.6",
    "webpack": "^1.12.2",
    "jquery": "^2.1.4",
    "webpack-bundle-size-analyzer": "^1.1.0",
    "webpack-dev-server": "^1.12.1"
  },
  "dependencies": {
    "c3": "^0.4.11-rc4",
    "d3": "^3.5.6",
    "datatables.net": "^1.10.10",
    "datatables.net-bs": "^1.10.10",
    "datatables.net-buttons": "^1.1.0",
    "datatables.net-buttons-bs": "^1.1.0",
    "history": "^1.12.5",
    "immutable": "^3.7.5",
    "jquery": "^2.1.4",
    "moment": "^2.10.6",
    "numeraljs": "^1.5.6",
    "react": "^0.14.3",
    "react-bootstrap": "^0.28.1",
    "react-bootstrap-daterangepicker": "^1.0.1",
    "react-dom": "^0.14.0",
    "react-redux": "^3.1.0",
    "redux": "^3.0.2",
    "redux-immutablejs": "0.0.7",
    "redux-thunk": "^1.0.0"
  }
}

或者我应该在一个package.json中真正包含2个jquery版本吗?

当我使用我的应用程序时,日期选择器会抛出以下错误消息(在开发人员工具控制台中)

Uncaught TypeError: $this.$picker.daterangepicker is not a function

1 个答案:

答案 0 :(得分:2)

经过数小时的故障排除。我能够解决此错误

问题是双重的

问题Uncaught TypeError: $this.$picker.daterangepicker is not a function是一个已知问题。并且已在此处记录

https://github.com/skratchdot/react-bootstrap-daterangepicker/issues/42

我的代码的问题是我在我的版本后面使用了“^”,所以即使我的package.json指定了1.0.1,因为^

它正在提升1.0.6

当我删除^并清理npm缓存时,我能够下载正确的版本并解决了问题。