当我运行 npm install 向我显示严重漏洞问题时,如何解决?

When I run npm install shows to me critical vulnerability problem, how to fix?

提问人:mukhammadrizooff 提问时间:11/12/2023 最后编辑:Adrian Klavermukhammadrizooff 更新时间:11/13/2023 访问量:51

问:

我正在尝试在显示“严重性漏洞”并尝试运行“npm audit fix”后关闭我的 react 项目并运行“npm install”,但它没有修复。

**npm i  **
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '4.2.1' },
npm WARN EBADENGINE   current: { node: 'v18.12.1', npm: '8.19.2' }

47 packages are looking for funding
  run `npm fund` for details

**1 critical severity vulnerability**

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
web-app> npm audit fix
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '4.2.1' },
npm WARN EBADENGINE   current: { node: 'v18.12.1', npm: '8.19.2' }
npm WARN EBADENGINE }

up to date, audited 410 packages in 3s

47 packages are looking for funding
  run `npm fund` for details

# npm audit report

lodash  <=4.17.20
Severity: critical
Regular Expression Denial of Service (ReDoS) in lodash - https://github.com/advisories/GHSA-x5rq-j2xg-h7qm
Prototype Pollution in lodash - https://github.com/advisories/GHSA-fvqr-27wr-82fm

fix available via `npm audit fix`
node_modules/lodash

**1 critical severity vulnerability**
ReactJS 节点.js Webpack ecmascript-6

评论

0赞 somethinghere 11/13/2023
您可以通过将该软件包升级到较新版本(如果可用)来解决此问题。如果没有,请注意存在严重漏洞,并且不要再使用该包。它发生在软件上,这就是生活。大多数时候,这不是您可以真正修复自己修复的东西,除非您想进入杂草并帮助更新软件包。

答:

0赞 tao 11/13/2023 #1

您正在使用,但项目需要 .nodev18.12.14.2.1

我们无法从您目前提供的信息中知道为什么会有限制,但您可以尝试将其删除(例如:内部:package.json

{
  "node": ">=18.0.0"
}

).或者干脆删除里面的当前条目,如果它在那里。"node"package.json

请记住,这可能会导致您的项目中断,因为它对所使用的版本有限制。node

如果上述方法不起作用,我建议您安装并使用该版本来服务/构建项目。最有可能的是,这会起作用。[email protected]