简体   繁体   English

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

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

I last used it on wednesday last week when I worked and it worked perfectly fine with no problems.我最后一次使用它是在上周星期三我工作的时候,它工作得非常好,没有任何问题。 Now that I came back today and wanted to start it with live-server it showed symbolds in the console and even waiting for 5 minutes nothing else happaned.现在我今天回来了,想用live-server启动它,它在控制台中显示符号,甚至等待 5 分钟,没有其他任何事情发生。

The weird stuff which is showing up出现的奇怪的东西

It tried to use powershell instead of the command prompt.它尝试使用 powershell 而不是命令提示符。 At first it told me that scripts are disabled so I searched that, enabled scripts and the exact same thing then happaned as in the command prompt.起初它告诉我脚本被禁用,所以我搜索了它,启用了脚本,然后在命令提示符下发生了完全相同的事情。

I didn't find anything about this weird problem.我没有发现任何关于这个奇怪问题的信息。 I even installed the oldest version of it but nothing changed.我什至安装了它的最旧版本,但没有任何改变。

For context, this issue doesn't happen on my laptop but it happens on my desktop at home My desktop and office pc both are a few years old in terms of hardware but couldn't be any more different besides windows 10 pro.就上下文而言,这个问题不会发生在我的笔记本电脑上,但它会发生在我家里的台式机上。我的台式机和办公电脑在硬件方面都有几年的历史,但除了 windows 10 pro 之外,再也没有什么不同了。

As i posted in the comment, the developer of the color.js & faker.js package has corrupted his packages on purpose: https://www.bleepingcomputer.com/news/security/dev-corrupts-npm-libs-colors-and-faker-breaking-thousands-of-apps/正如我在评论中发布的那样, color.jsfaker.js package 的开发人员故意损坏了他的包: https://www.bleepingcomputer.com/news/security/dev-corrupts-npm-libs-colors-和-faker-break-数以千计的应用程序/

The live-server depends on the color package: "colors": "latest", live-server取决于颜色 package: "colors": "latest",

You can see this if you take a look on the package.json如果您查看 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
    }
  }
}

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

A fix for live-server can be found here: https://github.com/Marak/colors.js/issues/285#issuecomment-1007890688可以在此处找到live-server的修复程序: https://github.com/Marak/colors.js/issues/285#issuecomment-1007890688

Just set it to a older version.只需将其设置为旧版本即可。

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. 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.

colors.js is a security vulnerability and should no longer be used. colors.js 是一个安全漏洞,不应再使用。 Check the news from Jan 2022.查看 2022 年 1 月的新闻。

I now use nozaki-colors https://github.com/RIAEvangelist/nozaki-colors我现在使用nozaki-colors https://github.com/RIAEvangelist/nozaki-colors

Today, Node.js has been released a new security patch.今天,Node.js 发布了新的安全补丁。 The problem has been solved for me.问题已经为我解决了。 You can update on https://nodejs.org/en/blog/vulnerability/jan-2022-security-releases/您可以更新https://nodejs.org/en/blog/vulnerability/jan-2022-security-releases/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM