我正在使用npm构建React的生产代码。
npm install
不会安装所有依赖项。
它总是一直显示一些警告
>npm install
npm WARN eslint-config-react-app@3.0.8 requires a peer of eslint@5.x but none is installed. You must install peer dependencies yourself.
npm WARN acorn-jsx@5.0.1 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server@2.11.5 requires a peer of webpack@^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package react is included as both a dev and production dependency.
npm WARN The package react-dom is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
audited 68747 packages in 99.074s
found 114 vulnerabilities (104 low, 9 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
我尝试手动安装依赖项,但是它们的不同版本又出现了。
这是我的package.json
{
"name": "react-pivottable",
"version": "0.8.0",
"description": "An Excel like pivot table",
"main": "PivotTableUI.js",
"files": [
"PivotTable.js",
"PivotTableUI.js",
"PlotlyRenderers.js",
"TableRenderers.js",
"Utilities.js",
"PivotTable.js.map",
"PivotTableUI.js.map",
"PlotlyRenderers.js.map",
"TableRenderers.js.map",
"Utilities.js.map",
"pivottable.css"
],
"scripts": {
"start": "webpack-dev-server",
"build": "react-scripts build",
"predeploy": "npm run build",
"deploy": "gh-pages -b master -d build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/805bluebell/frontEndProjProd.git"
},
"keywords": [
"react",
"pivottable"
],
"author": "Pankaj Kumar",
"license": "MIT",
"bugs": {
"url": "https://github.com/805bluebell/frontEndProjProd/issues"
},
"homepage": "https://805bluebell.github.io/frontEndProjProd",
"dependencies": {
"acorn": "^6.0.0",
"babel-core": "^6.26.3",
"gh-pages": "^2.0.1",
"immutability-helper": "^2.3.1",
"plotly.js": "^1.47.1",
"prop-types": "^15.5.10",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-draggable": "^3.0.3",
"react-scripts": "2.1.8",
"react-sortablejs": "^1.3.4",
"sortablejs": "^1.6.1",
"typescript": "^3.4.3",
"webpack-cli": "^3.3.0"
},
"peerDependencies": {
"react": ">=15.0.0",
"react-dom": ">=15.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^9.0.0",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.7",
"eslint": "^4.5.0",
"eslint-config-prettier": "^2.8.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-react": "^7.3.0",
"jest": "^21.2.1",
"papaparse": "^4.3.6",
"prettier": "^1.8.2",
"react": ">=15.0.0",
"react-dom": ">=15.0.0",
"react-dropzone": "^4.2.1",
"react-hot-loader": "^3.1.1",
"react-plotly.js": "^2.0.0",
"style-loader": "^0.19.0",
"webpack": "^4.4.0",
"webpack-dev-server": "^2.9.3"
}
}
我想进行生产构建以部署。
答案 0 :(得分:1)
您应该尝试使用纱线: