Node Live-server 突然停止工作,现在显示奇怪的东西

Node Live-server suddendly stopped working and now is showing weird stuff

我最后一次使用它是在上周的星期三我工作的时候,它工作得很好,没有任何问题。现在我今天回来了,想用 live-server 启动它,它在控制台中显示符号,甚至等待 5 分钟也没有发生任何其他事情。

The weird stuff which is showing up

它试图使用 powershell 而不是命令提示符。起初它告诉我脚本被禁用,所以我搜索了它,启用了脚本,然后发生了与命令提示符中完全相同的事情。

我没有找到关于这个奇怪问题的任何信息。我什至安装了它的最旧版本,但没有任何改变。

对于上下文,这个问题不会发生在我的笔记本电脑上,但它会发生在我家里的台式机上 我的台式机和办公电脑在硬件方面都有几年的历史,但除了 windows 10 pro 之外没有什么不同了。

正如我在评论中所说,color.js & faker.js 包的开发者故意损坏了他的包:https://www.bleepingcomputer.com/news/security/dev-corrupts-npm-libs-colors-and-faker-breaking-thousands-of-apps/

live-server取决于颜色包:"colors": "latest",

如果你在 package.json

上看一下就可以看到这个
{
  "name": "live-server",
  "version": "1.2.1",
  "description": "simple development http server with live reload capability",
  "keywords": [
    "front-end",
    "development",
    "tool",
    "server",
    "http",
    "cli"
  ],
  "author": "Tapio Vierros",
  "dependencies": {
    "chokidar": "^2.0.4",
    "colors": "latest",
    "connect": "^3.6.6",
    "cors": "latest",
    "event-stream": "3.3.4",
    "faye-websocket": "0.11.x",
    "http-auth": "3.1.x",
    "morgan": "^1.9.1",
    "object-assign": "latest",
    "opn": "latest",
    "proxy-middleware": "latest",
    "send": "latest",
    "serve-index": "^1.9.1"
  },
  "devDependencies": {
    "eslint": "^5.9.0",
    "jshint": "^2.9.6",
    "mocha": "^5.2.0",
    "supertest": "^3.3.0"
  },
  "scripts": {
    "lint": "eslint live-server.js index.js",
    "hint": "jshint live-server.js index.js",
    "test": "mocha test --exit && npm run lint"
  },
  "bin": {
    "live-server": "./live-server.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/tapio/live-server.git"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "preferGlobal": true,
  "license": "MIT",
  "eslintConfig": {
    "env": {
      "node": true
    },
    "rules": {
      "quotes": 0,
      "curly": 0,
      "strict": 0,
      "no-process-exit": 0,
      "eqeqeq": 1,
      "no-unused-vars": 1,
      "no-shadow": 1
    }
  }
}

有关 color.js 的更多信息:https://github.com/Marak/colors.js/issues/285

可在此处找到 live-server 的修复程序:https://github.com/Marak/colors.js/issues/285#issuecomment-1007890688

只需将其设置为旧版本即可。

The package.json for Live Server has Colors.js set to use the newest possible version available, latest, so I changed it back to the most recent Colors.js version that didn't have the issue, 1.4.0.

今天,Node.js 发布了一个新的安全补丁。这个问题已经为我解决了。您可以在 https://nodejs.org/en/blog/vulnerability/jan-2022-security-releases/

上更新