最近,当我编译我的scss文件时,我得到一个错误。错误信息如下:

Browserslist: canius -lite已经过时。请运行下一个命令npm update canius -lite browserslist

首先,正如消息所说,我运行npm update canius -lite browserslist,但它没有解决这个问题。 我删除了整个node_modules目录并重新安装,我也通过npm update更新了整个文件夹,但没有一个解决了这个问题。 我还重新安装了autoprefixer和browserslist,但没有一个解决问题。

如果我移除

"options": {
      "autoPrefix": "> 1%"
    }

从我的编译配置。Json,一切都很好,这意味着它可能与autoprefixer有关。另外,我手动将包版本更改为包上的最新版本。Json和重新安装,但没有运气。


当前回答

对我来说最有效的方法是首先建立一个项目

NPM运行构建

然后运行它

NPM运行启动

这将消失错误和应用程序加载良好。

其他回答

如果你使用纱线:

yarn upgrade

帮帮我吧

我确实把节点版本从12降级到10

EDIT

这个错误发生在我身上,因为我使用的是节点版本12。 当我降级到10.16.5版本时,此错误停止。这个错误发生在我的本地环境中,但在prod和staging中,它不会发生。在prod和staging节点版本是10。我只需要这样做,我不需要更新package.json中的任何包

继续上面的回答。

有相同的“插件错误”@MehrdadBabaki。我卸载了web编译器,删除了上面提到的AppData WebCompiler文件夹,然后重新打开VS2019,重新安装了web编译器。

然后我又去了WebCompiler文件夹,做了npm I autoprefixer@latest npm I caniuse-lite@latest和npm I caniuse-lite browserslist@latest

我也有同样的问题,这个命令对我有用

NPM I autoprefixer@latest

它自动在包中添加需要的依赖项。Json和包锁。Json文件如下:

package.json

"autoprefixer": "^9.6.5",

package-lock.json

"@angular-devkit/build-angular": {

...

"dependencies": {
    "autoprefixer": {
      "version": "9.4.6",
      "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.6.tgz",
      "integrity": "sha512-Yp51mevbOEdxDUy5WjiKtpQaecqYq9OqZSL04rSoCiry7Tc5I9FEyo3bfxiTJc1DfHeKwSFCUYbBAiOQ2VGfiw==",
      "dev": true,
      "requires": {
        "browserslist": "^4.4.1",
        "caniuse-lite": "^1.0.30000929",
        "normalize-range": "^0.1.2",
        "num2fraction": "^1.2.2",
        "postcss": "^7.0.13",
        "postcss-value-parser": "^3.3.1"
      }
    },

...

  }

...

"autoprefixer": {
    "version": "9.6.5",
    "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.6.5.tgz",
    "integrity": "sha512-rGd50YV8LgwFQ2WQp4XzOTG69u1qQsXn0amww7tjqV5jJuNazgFKYEVItEBngyyvVITKOg20zr2V+9VsrXJQ2g==",
    "requires": {
      "browserslist": "^4.7.0",
      "caniuse-lite": "^1.0.30000999",
      "chalk": "^2.4.2",
      "normalize-range": "^0.1.2",
      "num2fraction": "^1.2.2",
      "postcss": "^7.0.18",
      "postcss-value-parser": "^4.0.2"
    },

...

}

我降级节点版本,然后重新安装节点模块,问题已经解决。我是17岁。X到14.5.0