NPM似乎无法识别或未安装package.json中列出的软件包。我不断收到警告,阻止构建通过,这是一个大问题。具体来说:
npm WARN react-datepicker@0.49.0需要对等体react@^0.14.0 || ^ 15.0.0,但未安装。您必须自己安装对等依赖项。 npm WARN react-datepicker@0.49.0需要一个对等的react-dom@^0.14.0 || ^ 15.0.0,但未安装。您必须自己安装对等依赖项。 npm WARN react-modal@2.4.1需要对等体react@^0.14.0 || ^ 15.0.0,但未安装。您必须自己安装对等依赖项。 npm WARN react-modal@2.4.1需要一个对等的react-dom@^0.14.0 || ^ 15.0.0,但未安装。您必须自己安装对等依赖项。
考虑到我的反应依赖性为16.5.0,远远超出了^ 14.0或^ 15.0,因此我对这个警告感到困惑。我查过的所有内容都说要删除node_modules和package.json.lock,然后运行npm install,但这似乎并不能解决问题或真正更改任何内容。任何帮助将不胜感激。
这是我的package.json的副本
{
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001",
"devDependencies": {
"axios-mock-adapter": "^1.13.1",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.1",
"husky": "^0.13.4",
"lint-staged": "^3.6.1",
"node-sass-chokidar": "0.0.3",
"npm-run-all": "^4.0.2",
"prettier": "^1.10.2",
"react-scripts": "^1.1.4",
"react-test-renderer": "^16.0.0",
"redux-mock-store": "^1.5.1",
"redux-testkit": "^1.0.6"
},
"dependencies": {
"axios": "^0.16.2",
"babel-polyfill": "^6.26.0",
"big.js": "^5.0.3",
"class-names": "^1.0.0",
"create-app": "^0.6.0",
"d3": "^5.5.0",
"d3-array": "^1.2.1",
"d3-scale": "^1.0.6",
"debounce": "^1.0.2",
"font-awesome": "^4.7.0",
"jest-enzyme": "^4.0.1",
"leaflet": "^1.0.3",
"lodash": "^4.17.10",
"lodash.throttle": "^4.1.1",
"mixpanel-browser": "^2.13.0",
"moment": "^2.18.1",
"mousetrap": "^1.6.1",
"numeral": "^2.0.6",
"polyline-encoded": "^0.0.8",
"prop-types": "^15.5.10",
"query-string": "^5.0.0",
"raven-js": "^3.17.0",
"rc-trigger": "^1.11.2",
"react": "^16.5.0",
"react-bootstrap": "^0.32.0",
"react-countup": "^2.1.1",
"react-custom-scrollbars": "^4.1.2",
"react-datepicker": "^0.49.0",
"react-dom": "^16.5.0",
"react-fontawesome": "^1.6.1",
"react-gravatar": "^2.6.3",
"react-leaflet": "^1.3.0",
"react-list": "^0.8.6",
"react-markdown": "^2.5.1",
"react-modal": "^2.3.2",
"react-redux": "^5.0.5",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-slider": "^0.8.0",
"react-sortable-hoc": "^0.6.5",
"react-transition-group": "1.x",
"redux": "^3.6.0",
"redux-form": "^7.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"reselect": "^3.0.1",
"yarn": "^1.3.2"
},
"scripts": {
"build": "yarn run build-css && react-scripts build",
"build-css": "npm rebuild node-sass && node-sass-chokidar --include-path ./src --include-path ./node_modules ./src/ -o ./src/",
"deploy": "./deploy.sh",
"eject": "react-scripts eject",
"precommit": "lint-staged",
"start": "npm-run-all -p watch-css start-js",
"start-js": "react-scripts start",
"test": "react-scripts test --env=jsdom",
"watch-css": "yarn run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules ./src/ -o ./src/ --watch --recursive"
},
"lint-staged": {
"*.js": [
"prettier --single-quote --write",
"git add",
"prettier --write"
]
}
}
答案 0 :(得分:1)
考虑到我的反应依赖性为16.5.0,远远超出了^ 14.0或^ 15.0,因此我对这个警告感到困惑。
^15.0.0
表示从15.0.0
到(但不包括)16.0.0
的任何内容。
所以16.5.0
实际上太新了。