npm ERR!发现:type-fest@0.21.3 npm ERR!node_modules/type-fest npm ERR! type-fest@"^0.21.3" from ansi-escapes@4.3.2 npm ERR!node_modules/ansi-escapes npm ERR! ansi-escapes@"^4.2.1" from @jest/core@26.6.3 npm ERR!node_modules/@jest/core npm ERR! @jest/core@"^26.6.0" from jest@26.6.0 npm ERR!node_modules/jest npm ERR!peer jest@"^26.0.0" from jest-watch-typeahead@0.6.1 npm ERR!node_modules/jest-watch-typeahead npm ERR! 1 more (react-scripts) npm ERR! 1 more (jest-cli) npm ERR! ansi-escapes@"^4.3.1" from jest-watch-typeahead@0.6.1 npm ERR!node_modules/jest-watch-typeahead npm ERR! jest-watch-typeahead@"0.6.1" from react-scripts@4.0.3 npm ERR!node_modules/react-scripts npm ERR! react-scripts@"4.0.3" 来自根项目 npm ERR! 还有2个(jest-watcher, terminal-link) npm ERR! npm ERR!Could not resolve dependency: npm ERR! peerOptional type-fest@"^0.13.1" from @pmmmwh/react-refresh-webpack-plugin@0.4.3 npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin npm ERR! @pmmmwh/react-refresh-webpack-plugin@"0.4.3" from react-scripts@4.0.3 npm ERR!node_modules/react-scripts npm ERR! react-scripts@"4.0.3" from the root project npm ERR! npm ERR!修复上游依赖关系冲突,或者重试 npm ERR!使用 --force 或 --legacy-peer-deps 命令。 npm ERR! 接受一个不正确的(可能是坏的)依赖关系解析。 npm ERR! npm ERR!请参阅/home/azizdragon/.npm/eresolve-report.txt了解完整报告。

npm ERR!这个运行的完整日志可以在:npm ERR!
/home/azizdragon/.npm/_logs/2021-06-23T03_09_31_663Z-debug.log

我试着删除package-lock.json文件和node_modules文件夹并运行。

npm安装

但它导致了同样的漏洞,以下是我运行 "npm audit "时的报告。

browserslist 4.0.0 - 4.16.4 严重程度: 中度 正则表达式拒绝服务 - https://npmjs.com/advisories/1747 fix available via npm audit fix --force Will install react-scripts@1.1.5, which is a breaking change node_modules/react-dev-utils/node_modules/browserslist react-dev-utils >=6.0.0-next.03604a46 Depends on vulnerable versions of browserslist node_modules/react-dev-utils react-scripts >=0.10.0-alpha.328cb32e Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin Depends on vulnerable versions of @svgr/webpack Depends on vulnerable versions of mini-css-extract-plugin Depends on vulnerable versions of react-dev-utils Depends on vulnerable versions of webpack-dev-server node_modules/react-scripts

css-what <5.0.1 Severity: high Denial of Service - https://npmjs.com/advisories/1754 fix available via npm audit fix --force Will install react-scripts@1.1.5, which is a breaking change node_modules/svgo/node_modules/css-what css-select <=3.1.2
取决于css-what的脆弱版本
node_modules/svgo/node_modules/css-select svgo >=1.0.0 Depends on vulnerable versions of css-select node_modules/svgo @svgr/plugin-svgo * Depends on vulnerable versions of svgo node_modules/@svgr/plugin-svgo @svgr/webpack >=4.0.0 Depends on vulnerable versions of @svgr/plugin-svgo node_modules/@svgr/webpack react-scripts >=0.10.0-alpha.328cb32e Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin Depends on vulnerable versions of @svgr/webpack Depends on vulnerable versions of mini-css-extract-plugin Depends on vulnerable versions of react-dev-utils Depends on vulnerable versions of webpack-dev-server node_modules/react-scripts postcss-svgo >=4.0.0-nightly.2020.1.9 Depends on vulnerable versions of svgo node_modules/postcss-svgo cssnano-preset-default * Depends on vulnerable versions of postcss-normalize-url Depends on vulnerable versions of postcss-svgo node_modules/cssnano-preset-default cssnano 4.0.0-nightly.2020.1.9 - 4.1.11 Depends on vulnerable versions of cssnano-preset-default node_modules/cssnano optimize-css-assets-webpack-plugin 3.2.1 || 5.0.0 - 5.0.4 || 5.0.6 Depends on vulnerable versions of cssnano node_modules/optimize-css-assets-webpack-plugin

glob-parent <5.1.2 Severity: moderate Regular expression denial of service - https://npmjs.com/advisories/1751 可通过 npm audit fix --force 修复将安装react-scripts@1.1.5,这是一个 破坏性变化 node_modules/watchpack-chokidar2/node_modules/glob-parent node_modules/webpack-dev-server/node_modules/glob-parent chokidar 1.0.0-rc1 - 2.1.8 取决于 glob-parent 的脆弱版本 node_modules/watchpack-chokidar2/node_modules/chokidar
node_modules/webpack-dev-server/node_modules/chokidar watchpack-chokidar2 * Depends on vulnerable versions of chokidar node_modules/watchpack-chokidar2 watchpack 1.7.2 - 1.7.5 Depends on vulnerable versions of watchpack-chokidar2 node_modules/watchpack webpack 4.44.0 - 4.46.0 Depends on vulnerable versions of watchpack node_modules/webpack webpack-dev-server 2.0.0-beta - 3.11.2 Depends on vulnerable versions of chokidar node_modules/webpack-dev-server @pmmmwh/react-refresh-webpack-plugin 0.3.1 - 0.5.0-beta.4 Depends on vulnerable versions of webpack-dev-server node_modules/@pmmmwh/react-refresh-webpack-plugin react-scripts >=0.10.0-alpha.328cb32e Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin Depends on vulnerable versions of @svgr/webpack Depends on vulnerable versions of mini-css-extract-plugin Depends on vulnerable versions of react-dev-utils Depends on vulnerable versions of webpack-dev-server node_modules/react-scripts

normalize-url <=4.5.0 || 5.0.0 - 5.3.0 || 6.0.0 Severity: high Regular Expression Denial of Service - https://npmjs.com/advisories/1755 可通过 npm audit fix --force 修复将安装react-scripts@1.1.5,这是一个破坏性的改变 node_modules/normalize-url node_modules/postcss-normalize-url/node_modules/normalize-url
mini-css-extract-plugin 0.6.0 - 1.0.0 Depends on vulnerable versions of normalize-url node_modules/mini-css-extract-plugin react-scripts >=0.10.0-alpha.328cb32e Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin Depends on vulnerable versions of @svgr/webpack Depends on vulnerable versions of mini-css-extract-plugin Depends on vulnerable versions of react-dev-utils Depends on vulnerable versions of webpack-dev-server node_modules/react-scripts postcss-normalize-url <=4.0.1 Depends on vulnerable versions of normalize-url
node_modules/postcss-normalize-url cssnano-preset-default * 取决于脆弱版本的postcss-normalize-url 取决于脆弱版本的postcss-svgo node_modules/cssnano-preset-default cssnano 4.0.0-nightly.2020.1.9 - 4.1.11 依赖于cssnano-preset-default的脆弱版本 node_modules/cssnano optimize-css-assets-webpack-plugin 3.2.1 || 5.0.0 - 5.0.4 || 5.0.6 依赖于脆弱的cssnano版本 node_modules/optimize-css-assets-webpack-plugin

22个漏洞(9个中度,13个高度)。

要解决不需要注意的问题,运行:npm audit fix

要解决所有问题(包括破坏性修改),请运行:npm audit fix --force

我是否应该使用npm audit fix --force? 如果有帮助,我运行的是Linux Mint 18.3 Cinnamon 64位 Node版本:v16.0.0 NPM版本:7.18.1

提前感谢。

4 个评论
多运行几次npm audit fix,那么我想适度的数字应该会减少,或者每次的警告都会减少,实际上又可以工作了。我曾经用这种方式解决过。
遇到了同样的问题。作为node生态系统的新成员,我现在开始担心了--如果基本的、标准的脚本创造了一个具有如此多关键漏洞的应用程序,这说明工具的成熟度如何......
奇怪的是,我刚好读到了 丹-阿布拉莫夫的这篇博文 关于这个问题。大意是,这些漏洞中的许多可能无法在实践中影响到用Create React App创建的应用程序,因为这些依赖关系中的许多只是在开发中使用。
@alexakarpov 阅读 overreacted.io/npm-audit-broken by-design 更多细节,但这并不是对这些工具成熟度的反映,而是对 npm audit 的实现存在问题的反映。如果你在Node.js应用程序的背景下使用它们,并将其部署到生产中,这些问题可能是一个问题,但在Create React App的背景下,它们并不是。你只需要担心被 npm audit --production 标记的东西。
javascript
node.js
reactjs
linux
npm
aziz aon
aziz aon
发布于 2021-06-23
1 个回答
Abbas Hosseini
Abbas Hosseini
发布于 2021-09-10
已采纳
0 人赞同

正如马修-戴利在本博文后的评论中提到的那样 npm审计。设计中的破绽 作者:丹-阿布拉莫夫。 大部分或者说所有的警告都与开发中的依赖关系有关,所以它们不会影响你的生产构建。 ,而且你根本不需要担心修复它们的问题。

这并不意味着开发依赖的漏洞在每种情况下、每个软件包和每个版本都是无害的。