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

前端 未结 20 2289
忘掉有多难
忘掉有多难 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:11

    I found a short cut rather than going through vs code appData/webCompiler, I added it as a dependency to my project with this cmd npm i caniuse-lite browserslist. But you might install it globally to avoid adding it to each project.

    After installation, you could remove it from your project package.json and do npm i.

    Update:

    In case, Above solution didn't fix it. You could run npm update, as this would upgrade deprecated/outdated packages.

    Note:

    After you've run the npm update, there may be missing dependencies. Trace the error and install the missing dependencies. Mine was nodemon, which I fix by npm i nodemon -g

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

    For Angular Developers

    Although, I'm answering this very late. I have a bad habit of checking changelogs of every library I use

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

    npm --depth 9999 update fixed the issue for me--apparently because package-lock.json was insisting on the outdated versions.

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

    I'm not exactly sure where my problem was, but I believe it was because I was using the same global packages from both npm and Yarn.

    I uninstalled all the npm global packages, then when using yarn commands once again, the problem was gone.

    To see global packages installed...

    for npm:

    npm ls -g --depth=0
    

    for Yarn:

    yarn global list
    

    I then uninstalled each package I saw in the npm listing, using:

    npm uninstall -g <package-name>
    
    0 讨论(0)
  • 2020-12-08 04:16

    Deleting node_modules and package-lock.json and npm i solve the issue for me.

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

    Answer from @Alexandr Nil is safe, and was effective for me

    I am writing as a full answer because it is easy to miss his comment.

    npm --depth 20 update caniuse-lite browserslist 
    

    This is good because:

    1. There is no deletion of package-lock.json. Deleting that leaves you vulnerable to many packages getting upgraded with breaking changes.

    2. It is explicit and very limited on which things are to be updated.

    3. It avoids the very large depth of 99 or 9999 which will work on some projects and systems, but not on others. If you have limited the depth to too small a number, it will not break anything. You can increase the depth and try again, until the project compiles successfully.

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