我使用npm install命令反复收到npm对等依赖项错误。这是我的package.json,我对React和Webpack的对等依赖未得到满足
npm WARN react-datepicker@0.25.0 requires a peer of react@^0.14.0 but none was installed. npm WARN babel-loader@6.2.4 requires a peer of webpack@1 || ^2.1.0-beta but none was installed. npm WARN desktop-react@1.0.0 No repository field. npm WARN desktop-react@1.0.0 license should be a valid SPDX license expression { "name": "xxxxxxxxx", "version": "x.x.x", "description": "", "main": "index.js", "author": "", "license": "xxxxxxx", "dependencies": { "bootstrap": "^3.3.6", "fs": "0.0.2", "history": "^1.17.0", "immutable": "^3.8.1", "isomorphic-fetch": "^2.2.1", "lodash": "^4.11.1", "moment": "^2.13.0", "react": "^15.0.1", "react-autosuggest": "^3.7.3", "react-bootstrap": "^0.29.1", "react-datepicker": "^0.25.0", "react-dom": "^15.0.1", "react-redux": "^4.4.5", "react-router": "^2.3.0", "react-select": "^1.0.0-beta12", "redux": "^3.5.2" }, "devDependencies": { "babel-core": "^6.7.7", "babel-loader": "^6.2.4", "babel-preset-es2015": "^6.6.0", "babel-preset-react": "^6.5.0", "bootstrap": "^3.3.6", "css-loader": "^0.23.1", "redux-devtools": "^3.2.0", "style-loader": "^0.13.1" } }
好吧,首先,这些不是错误,它们是警告。它们实际上并不会阻止您的代码运行,只是在您的依赖项有问题的情况下提醒您。
实际上,peerDependencies软件包是一种指定方式,“使用我,您还应该安装 y 软件包的 x 版本”。就您而言,有两个问题: __
peerDependencies
react-datepicker
babel-loader
npm install webpack --save-dev
希望在这种情况下,您将来能够了解如何解释这些警告!