Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`

前端 未结 20 2291
忘掉有多难
忘掉有多难 2020-12-08 03:31

Recently, when I compile my scss files I get an error. The error message says:

Browserslist: caniuse-lite is outdated. Please run next command n

相关标签:
20条回答
  • 2020-12-08 04:16

    I did downgrade the node version from 12 to 10

    EDIT

    This error occurred with me because I was using node version 12. When I downgrade to version 10.16.5 this error stops. This error happened in my local env, but in prod and staging, it not happens. In prod and staging node version is 10.x so I just do this and I didn't need to update any package in my package.json

    0 讨论(0)
  • 2020-12-08 04:23

    Many advise you to remove the package-lock.json or the yarn.lock. This is clearly a bad idea!

    I am using Yarn and I was able to correct this problem by removing only the caniuse-db and caniuse-lite entries in my yarn.lock and doing a yarn.

    It is not necessary to break the main function of the lockfile by deleting it.

    0 讨论(0)
  • 2020-12-08 04:23

    Minimal solution that worked for me for current project

    • A create-react-app project
    • Ubuntu / *nix
    • 2020
    • Node 14.7

    delete node_modules/browserslist directory in the project

    now

    npm run build
    

    no longer generates that message

    0 讨论(0)
  • 2020-12-08 04:24

    If you use yarn:

    yarn upgrade
    

    Help for me

    0 讨论(0)
  • 2020-12-08 04:25

    It sounds like you are using Visual Studio's Web Compiler extension. There is an open issue for this found here: https://github.com/madskristensen/WebCompiler/issues/413

    There is a workaround posted in that issue:

    1. Close Visual Studio
    2. Head to C:\Users\USERNAME\AppData\Local\Temp\WebCompilerX.X.X (X is the version of WebCompiler)
    3. Delete following folders from node_modules folder: caniuse-lite and browserslist Open up CMD (inside C:\Users\USERNAME\AppData\Local\Temp\WebCompilerX.X.X) and run: npm i caniuse-lite browserslist
    0 讨论(0)
  • 2020-12-08 04:25

    Try this it solved my problem npx browserslist@latest --update-db

    0 讨论(0)
提交回复
热议问题