npm warning: It is recommended you upgrade to 3.2.7 or 4.3.1

kar*_*ren 4 node.js npm

I'm getting the warning:

npm WARN deprecated debug@4.1.1: 
Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity 
ReDos regression when used in a Node.js environment. 
It is recommended you upgrade to 3.2.7 or 4.3.1.  
Run Code Online (Sandbox Code Playgroud)

Versions of npm and node:

npm -v

7.3.0
Run Code Online (Sandbox Code Playgroud)
node -v 

v15.5.0
Run Code Online (Sandbox Code Playgroud)

EDIT: package.json:

{
  "name": "example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": 
"git+https://example@bitbucket.org/username/example.git"
  },
  "author": "",
  "license": "ISC",
  "homepage": "https://bitbucket.org/karenshahmuusernameadyan/example#readme",
  "dependencies": {
    "socket.io": "^3.0.4"
  }
}
Run Code Online (Sandbox Code Playgroud)

Tro*_*ott 5

查看您的 package.json,问题出在当前版本的 socket.io 中。由于看起来您刚刚开始开发某些东西,因此您现在可以忽略警告并留意新版本。已经有一个打开的拉取请求来更新debug依赖项。我的猜测是这个漏洞最近才被披露,并且很快就会被修复。

package.json对于面临类似但不相同问题的人的原始答案(在添加到问题之前):

如果你想尝试焦土方法:首先删除node_modulespackage-lock.json。然后跑npm install。这将在符合您的要求的同时更新所有内容package.json。一个潜在的缺点是它可能会更新很多其他内容,而您可能由于各种原因不需要这些更新。

更集中的方法:可以npm自动为您解决此问题。运行npm audit并查看它是否标记了调试库。如果确实如此,请按照其说明进行操作以尝试修复它。(可能只是这样npm audit fix,但在某些情况下,修复会更复杂。)有时,你运行npm audit fix它并不能修复问题。在这种情况下,请使用其他方法之一。

完全手动的方法:用于npm ls查找 Debug@4.1.1 的安装位置。然后,您需要弄清楚它是否是您可以自己更新的依赖项(如果它是您自己的 package.json 中的直接依赖项),或者它是否是依赖项的依赖项并且您依赖其他人进行更新。由于修复的版本是 4.x,因此很可能只需使用 Debug 重新安装依赖项即可修复它。