Caniuse lite is outdated как исправить

Recently, when I compile my scss files I get an error. The error message says: Browserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist First, as the m...

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

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

First, as the message says, I ran npm update caniuse-lite browserslist but it didn’t fix the issue.
I deleted the whole node_modules directory and installed again, also I updated the whole folder by npm update but none of them solved the issue.
I also reinstalled autoprefixer and browserslist but none of them solved the issue.

If I remove

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

from my compilerconfig.json, everything works fine which means probably it is related to autoprefixer. Also, I manually changed the package version to the latest version on package.json and reinstalled but no luck.

Liran H's user avatar

Liran H

8,1637 gold badges37 silver badges48 bronze badges

asked Mar 20, 2019 at 23:49

Nick Mehrdad Babaki's user avatar

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

answered Jul 31, 2020 at 14:21

Dipanker Shah's user avatar

10

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:UsersUSERNAMEAppDataLocalTempWebCompilerX.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:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.X) and run: npm i caniuse-lite browserslist

Shashank Agrawal's user avatar

answered Mar 21, 2019 at 14:50

Scott Kuhl's user avatar

Scott KuhlScott Kuhl

98110 silver badges11 bronze badges

4

Simple, safe solution

The 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 --save caniuse-lite browserslist 

This is good because:

  1. There is no deletion of package-lock.json. Deleting that would leave you vulnerable to many packages getting upgraded with breaking changes, and you have a much bigger headache than you had before!

  2. It is easy to understand exactly what it is doing, because it is explicit and very limited on what is 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. I don’t know whether I actually needed 20, or could have managed with a smaller depth, such as 5 or 10. But with a depth of 20 took less than a minute to run.

  4. It is quick and easy!

Thank you to @Zbyszek for suggesting to add the «—save» option. And yes, —depth is currently deprecated, but I assume they will replace it with something else rather than entirely remove it, so for now this seems to be the least destructive approach.

answered Dec 6, 2020 at 12:58

Eureka's user avatar

EurekaEureka

4,1131 gold badge15 silver badges21 bronze badges

1

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.

answered Nov 16, 2020 at 11:02

Kévin Berthommier's user avatar

4

For Angular Developers

Although, I’m answering this very late. I have a bad habit of checking changelogs of every library I use 😀 and while checking the release notes of Angular CLI, I figured out that they released a new patch yesterday (9th Jan 2020) which fixes this issue.

https://github.com/angular/angular-cli/releases/tag/v8.3.22

So when you will run ng update, you should get updates for @angular/cli:

enter image description here

And running ng update @angular/cli will fix this warning.

Cheers!

answered Jan 10, 2020 at 2:21

Shashank Agrawal's user avatar

Shashank AgrawalShashank Agrawal

24.4k11 gold badges85 silver badges119 bronze badges

0

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

answered May 30, 2019 at 15:11

Akolade Adesanmi's user avatar

1

Continuation of answer above.

Had the same «plugin error» as @MehrdadBabaki. I uninstalled web compiler, deleted the AppData WebCompiler folder mentioned above, then reopened VS2019 and reinstalled web compiler.

THEN I went to the WebCompiler folder again and did npm i autoprefixer@latest npm i caniuse-lite@latest and npm i caniuse-lite browserslist@latest

answered Apr 26, 2019 at 19:52

dirq's user avatar

dirqdirq

9602 gold badges11 silver badges26 bronze badges

1

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

answered Apr 18, 2019 at 2:01

Brett Zamir's user avatar

Brett ZamirBrett Zamir

13.8k6 gold badges51 silver badges75 bronze badges

4

In my case, I deleted out the caniuse-lite, browserslist folders from node_modules.

Then I type the following command to install the packages.

npm i -g browserslist caniuse-lite --save

worked fine.

Shashank Agrawal's user avatar

answered Jan 17, 2020 at 4:37

Gebru Welay Gerezigiher's user avatar

1

There is an environment variable >= 4.5.4, BROWSERSLIST_IGNORE_OLD_DATA, that you can set truthy to suppress the warning (BROWSERSLIST_IGNORE_OLD_DATA=true). See commit Add BROWSERSLIST_IGNORE_OLD_DATA environment variable.

Here’s a snippet of the relevant code from that commit showing the early bailout upon checking this environment variable:

module.exports = {
  // ...
  oldDataWarning: function oldDataWarning (agentsObj) {
    if (dataTimeChecked) return
    dataTimeChecked = true
    if (process.env.BROWSERSLIST_IGNORE_OLD_DATA) return

    // ...
    console.warn(
      'Browserslist: caniuse-lite is outdated. ' +
      'Please run next command `' + command + '`'
    )
    // ...
  }
  // ...
}

0

As mentioned in Scott Kuhl’s answer this issue is mentioned in
https://github.com/madskristensen/WebCompiler/issues/413

For me, running the command npm i caniuse-lite- browserslist only worked for about 1/2 a day before it was an issue again.

The following solution, mentioned in the post, works much better. This updates the node.js file so that it uses console.log instead of console.warn when returning these errors.

You can manually update this file located at
C:Users[Username]AppDataLocalTempWebCompiler[VersionNumber]node_modulesbrowserslist

Or, so that it is done automatically, add the following to your .csproj file by:

  1. Right click on project file and select «Unload Project»
  2. Edit the .csproj file
  3. Paste the following into the project file. I pasted it towards the end of the file, before the </Project> end tag and before the build web compiler package was imported.
    <ItemGroup>
        <PackageReference Include="MSBuildTasks" Version="1.5.0.235">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
        </PackageReference>
    </ItemGroup>
    <PropertyGroup>
        <TempFolder>$([System.IO.Path]::GetTempPath())</TempFolder>
    </PropertyGroup>
    <ItemGroup>
        <BrowsersListNodeJsFiles Include="$(TempFolder)WebCompiler*node_modulesbrowserslistnode.js" />
    </ItemGroup>
    <Target Name="BrowsersListWarningsAsInfo" BeforeTargets="WebCompile">
        <FileUpdate Files="@(BrowsersListNodeJsFiles)"
                    Regex="console.warn"
                    ReplacementText="console.log" />
    </Target>

  1. Reload the project back into the solution.

answered Mar 27, 2019 at 12:51

Sylvia's user avatar

SylviaSylvia

1,0229 silver badges20 bronze badges

1

I had same problem too this command works for me

npm i autoprefixer@latest

It automatically added need dependency in package.json and package-lock.json file like below:

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"
    },

...

}

answered Oct 23, 2019 at 13:23

Samet ÇELİKBIÇAK's user avatar

0

My Issue solved by doing this in my react native project

npx browserslist@latest —update-db

console ->

Latest version:     1.0.30001363
Installed version:  1.0.30001296
Removing old caniuse-lite from lock file
Installing new caniuse-lite version
$ npm install caniuse-lite
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
Cleaning package.json dependencies from caniuse-lite
$ npm uninstall caniuse-lite
caniuse-lite has been successfully updated

Target browser changes:
- and_chr 96
+ and_chr 103
- and_ff 95
+ and_ff 101
- android 96
+ android 103
- chrome 96
- chrome 95
- chrome 94
+ chrome 103
+ chrome 102
+ chrome 101
- edge 96
- edge 95
+ edge 103
+ edge 102
- firefox 95
- firefox 94
+ firefox 102
+ firefox 101
- ios_saf 15.2
- ios_saf 15.0-15.1
+ ios_saf 15.5
+ ios_saf 15.4
+ ios_saf 15.2-15.3
- opera 82
- opera 81
+ opera 87
+ opera 86
+ opera 85
- safari 15.2
- safari 15.1
- safari 13.1
+ safari 15.5
+ safari 15.4
- samsung 15.0
- samsung 14.0
+ samsung 17.0
+ samsung 16.0

answered Jul 6, 2022 at 11:59

Sayan Dey's user avatar

1

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>

answered Oct 30, 2019 at 12:35

tno2007's user avatar

tno2007tno2007

1,81423 silver badges15 bronze badges

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

answered Oct 24, 2019 at 2:44

Murilo Ângelo's user avatar

2

I downgrade node version, then reinstall node modules and problem has gone. In my case from 17.X to 14.5.0

answered Apr 17, 2022 at 8:25

Mikki Ukraine's user avatar

Deleting node_modules and reinstalling (npm i) worked for me. Did not delete package-lock.json.

answered Jan 19 at 14:59

Nick Manning's user avatar

Nick ManningNick Manning

2,7561 gold badge29 silver badges49 bronze badges

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

answered May 1, 2020 at 10:57

U.A's user avatar

U.AU.A

2,7932 gold badges23 silver badges35 bronze badges

1

I’ve fixed this issue by doing, step by step:

  1. remove node_modules
  2. remove package-lock.json,
  3. run npm --depth 9999 update
  4. run npm install

answered May 18, 2020 at 11:15

Bartek's user avatar

BartekBartek

5525 silver badges6 bronze badges

1

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

answered Aug 16, 2020 at 13:26

Michael Durrant's user avatar

Michael DurrantMichael Durrant

92k94 gold badges319 silver badges483 bronze badges

2

The thing that worked for me is to first build the project like

npm run build

then run it like

npm run start

this will disappear error and application loading fine.

answered Apr 19, 2021 at 20:32

Rahman Bokhari's user avatar

The below steps worked for me

  1. rm -rf node_modules/
  2. yarn
  3. yarn upgrade caniuse-lite browserlist
  4. restarting server & clear browser cache.

answered Mar 15, 2021 at 22:52

Sankeerna Reddy's user avatar

To fix the issue you can type below command:

‘npm -g update’

answered Jan 17, 2020 at 7:39

Virendra's user avatar

VirendraVirendra

5674 silver badges5 bronze badges

If you use yarn:

yarn upgrade

Help for me

answered Jun 22, 2020 at 5:24

TriSTaR's user avatar

TriSTaRTriSTaR

4073 silver badges19 bronze badges

Comments

@PostMidnight

@ai
ai

mentioned this issue

Jan 31, 2019

@ai
ai

reopened this

Jan 31, 2019

vanderhoop

added a commit
to stride-nyc/remote_retro
that referenced
this issue

Apr 30, 2020

@vanderhoop

caasi

added a commit
to caasi/caasih.net
that referenced
this issue

May 7, 2020

@caasi

joelmichael

added a commit
to fosterful/scheduler
that referenced
this issue

May 22, 2020

@joelmichael

Apparently can't use yarn for this.
Gets rid of caniuse-lite deprecation warning when running bin/webpack.
postcss/autoprefixer#1184

Kamigami55

added a commit
to CAMPUS-NYCU/SmartCampus
that referenced
this issue

May 22, 2020

@Kamigami55

@postcss
postcss

locked as resolved and limited conversation to collaborators

Jun 10, 2020

When doing a vue-cli build through npm I get this error:

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

This was working until recently and I’m not sure what would cause this to start failing. Seems like some timeframe hit that made it start reporting as ‘outdated’ but I don’t know what to update to fix it.

I have tried running the suggested command but it doesn’t do the trick. I am doing this through npm and am not using Visual Studio, so I am not using WebCompiler (and that directory doesn’t exist in my user folder) so the solution in Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist` doesn’t apply.

This also happens on our build system running through VSO, so it isn’t just my box.

Here is my package.json file:

{
  "name": "productName.portal",
  "version": "1.0.0",
  "description": "productName.portal static content",
  "main": "gulpfile.js",
  "keywords": [
    "gulp",
    "task"
  ],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/preset-react": "^7.0.0",
    "@types/jest": "^23.1.4",
    "@types/jquery": "^3.3.4",
    "@types/underscore": "^1.8.8",
    "@voerro/vue-tagsinput": "^1.8.0",
    "@vue/cli-plugin-babel": "^3.0.0-rc.4",
    "@vue/cli-plugin-typescript": "^3.0.0-rc.4",
    "@vue/cli-plugin-unit-jest": "^3.0.1",
    "@vue/cli-service": "3.0.0-rc.4",
    "@vue/test-utils": "^1.0.0-beta.20",
    "axios": "^0.18.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-polyfill": "^6.26.0",
    "copy-webpack-plugin": "^4.5.2",
    "gulp": "^3.9.0",
    "gulp-clean-css": "latest",
    "gulp-concat": "latest",
    "gulp-sourcemaps": "latest",
    "gulp-uglify": "latest",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "node-sass": "^4.9.0",
    "sass-loader": "^7.0.1",
    "script-loader": "^0.7.2",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "ts-jest": "^23.0.0",
    "underscore": "^1.9.1",
    "vue-i18n": "^8.0.0",
    "vue-js-modal": "^1.3.16",
    "vue-loading-overlay": "^2.1.0",
    "vue-simple-spinner": "^1.2.8",
    "vue-template-compiler": "^2.5.16",
    "vue-toasted": "^1.1.24",
    "vuejs-datepicker": "^1.5.2"
  },
  "dependencies": {
    "node": "^9.9.0",
    "typescript": "^3.0.1",
    "trie-search": "^1.2.8",
    "vue": "^2.5.16",
    "vue-class-component": "^6.0.0",
    "vue-property-decorator": "^7.0.0",
    "vuex": "^3.0.1"
  },
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "unittest": "vue-cli-service test:unit"
  }
}

When doing a vue-cli build through npm I get this error:

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

This was working until recently and I’m not sure what would cause this to start failing. Seems like some timeframe hit that made it start reporting as ‘outdated’ but I don’t know what to update to fix it.

I have tried running the suggested command but it doesn’t do the trick. I am doing this through npm and am not using Visual Studio, so I am not using WebCompiler (and that directory doesn’t exist in my user folder) so the solution in Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist` doesn’t apply.

This also happens on our build system running through VSO, so it isn’t just my box.

Here is my package.json file:

{
  "name": "productName.portal",
  "version": "1.0.0",
  "description": "productName.portal static content",
  "main": "gulpfile.js",
  "keywords": [
    "gulp",
    "task"
  ],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/preset-react": "^7.0.0",
    "@types/jest": "^23.1.4",
    "@types/jquery": "^3.3.4",
    "@types/underscore": "^1.8.8",
    "@voerro/vue-tagsinput": "^1.8.0",
    "@vue/cli-plugin-babel": "^3.0.0-rc.4",
    "@vue/cli-plugin-typescript": "^3.0.0-rc.4",
    "@vue/cli-plugin-unit-jest": "^3.0.1",
    "@vue/cli-service": "3.0.0-rc.4",
    "@vue/test-utils": "^1.0.0-beta.20",
    "axios": "^0.18.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-polyfill": "^6.26.0",
    "copy-webpack-plugin": "^4.5.2",
    "gulp": "^3.9.0",
    "gulp-clean-css": "latest",
    "gulp-concat": "latest",
    "gulp-sourcemaps": "latest",
    "gulp-uglify": "latest",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "node-sass": "^4.9.0",
    "sass-loader": "^7.0.1",
    "script-loader": "^0.7.2",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "ts-jest": "^23.0.0",
    "underscore": "^1.9.1",
    "vue-i18n": "^8.0.0",
    "vue-js-modal": "^1.3.16",
    "vue-loading-overlay": "^2.1.0",
    "vue-simple-spinner": "^1.2.8",
    "vue-template-compiler": "^2.5.16",
    "vue-toasted": "^1.1.24",
    "vuejs-datepicker": "^1.5.2"
  },
  "dependencies": {
    "node": "^9.9.0",
    "typescript": "^3.0.1",
    "trie-search": "^1.2.8",
    "vue": "^2.5.16",
    "vue-class-component": "^6.0.0",
    "vue-property-decorator": "^7.0.0",
    "vuex": "^3.0.1"
  },
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "unittest": "vue-cli-service test:unit"
  }
}


Недавно, когда я компилирую свои файлы scss, я получаю сообщение об ошибке. В сообщении об ошибке говорится:

Список браузеров: caniuse-lite устарел. Пожалуйста, запустите следующую командуnpm update caniuse-lite browserslist

Во-первых, как говорится в сообщении, я побежал, npm update caniuse-lite browserslistно это не устранило проблему. Я удалил весь каталог nod-modules и снова установил его, также я обновил всю папку, npm updateно ни один из них не решил проблему. Я также переустановил автопрефиксер и список браузеров, но ни один из них не решил проблему.

Если я удалю

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

по моему compilerconfig.json, все работает нормально, значит, вероятно, это связано с автопрефиксом. Кроме того, я вручную изменил версию пакета на последнюю версию package.jsonи переустановил, но безуспешно.

Ответы:


Похоже, вы используете расширение веб-компилятора Visual Studio. Здесь есть открытая проблема: https://github.com/madskristensen/WebCompiler/issues/413

В этом выпуске есть обходной путь:

  1. Закройте Visual Studio
  2. C:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.XПерейдите к (X — версия WebCompiler)
  3. Удалите из node_modulesпапки следующие папки : caniuse-liteи browserslist
    Откройте CMD (внутри C:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.X) и запустите:npm i caniuse-lite browserslist





Попробуйте это решить мою проблему npx browserslist@latest --update-db







Для разработчиков Angular

Хотя я отвечаю на это очень поздно. У меня есть плохая привычка проверять журналы изменений каждой библиотеки, которую я использую 😀, и, проверяя примечания к выпуску Angular CLI, я выяснил, что вчера (9 января 2020 года) они выпустили новый патч, который исправляет эту проблему.

https://github.com/angular/angular-cli/releases/tag/v8.3.22

Поэтому при запуске ng updateвы должны получать обновления для @angular/cli:

введите описание изображения здесь

И бег ng update @angular/cliисправит это предупреждение.

Ура!


Я нашел короткий путь, вместо того, чтобы идти дальше vs code appData/webCompiler, я добавил его как зависимость к моему проекту с этим cmd npm i caniuse-lite browserslist . Но вы можете установить его глобально, чтобы не добавлять его в каждый проект.

После установки вы можете удалить его из своего проекта package.jsonи сделатьnpm i .

Обновить:

В случае, если вышеуказанное решение не помогло. Ты мог бежатьnpm update , так как это обновит устаревшие / устаревшие пакеты.

Заметка:

После запуска обновления npm могут отсутствовать зависимости. Отследите ошибку и установите недостающие зависимости. Мой был nodemon, который я исправляюnpm i nodemon -g



Продолжение ответа выше .

Была такая же «ошибка плагина», как у @MehrdadBabaki. Я удалил веб-компилятор, удалил папку AppData WebCompiler, упомянутую выше, затем повторно открыл VS2019 и переустановил веб-компилятор.

ТОГДА я снова зашел в папку WebCompiler и сделал npm i autoprefixer@latest npm i caniuse-lite@latestиnpm i caniuse-lite browserslist@latest



npm --depth 9999 updateисправил проблему для меня — видимо, потому что package-lock.jsonнастаивал на устаревших версиях.



В моем случае, я удалил вне caniuse-lite, browserslistпапки с node_modules.

Затем я набираю следующую команду, чтобы установить пакеты.

npm i -g browserslist caniuse-lite --save

работал нормально.



Удаление node_modulesи package-lock.jsonи npm iрешить этот вопрос для меня.



Как упоминалось в ответе Скотта Куля, эта проблема упоминается в
https://github.com/madskristensen/WebCompiler/issues/413

Для меня запуск команды npm i caniuse-lite- browserslist работало только около 1/2 дня, прежде чем это снова стало проблемой.

Следующее решение, упомянутое в сообщении, работает намного лучше. Это обновляет файл node.js, чтобы он использовался console.logвместо того, чтобы console.warnвозвращать эти ошибки.

Вы можете вручную обновить этот файл, расположенный в C: Users [Имя пользователя] AppData Local Temp WebCompiler [VersionNumber] node_modules browserslist

Или, чтобы это выполнялось автоматически, добавьте в файл .csproj следующее:

  1. Щелкните правой кнопкой мыши файл проекта и выберите «Выгрузить проект».
  2. Отредактируйте файл .csproj
  3. Вставьте следующее в файл проекта. Я вставил его в конец файла, перед </Project>закрывающим тегом и до того, как был импортирован пакет веб-компилятора сборки.
    <ItemGroup>
        <PackageReference Include="MSBuildTasks" Version="1.5.0.235">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
        </PackageReference>
    </ItemGroup>
    <PropertyGroup>
        <TempFolder>$([System.IO.Path]::GetTempPath())</TempFolder>
    </PropertyGroup>
    <ItemGroup>
        <BrowsersListNodeJsFiles Include="$(TempFolder)WebCompiler*node_modulesbrowserslistnode.js" />
    </ItemGroup>
    <Target Name="BrowsersListWarningsAsInfo" BeforeTargets="WebCompile">
        <FileUpdate Files="@(BrowsersListNodeJsFiles)"
                    Regex="console.warn"
                    ReplacementText="console.log" />
    </Target>

  1. Перезагрузите проект обратно в решение.


Я исправил эту проблему, выполнив, шаг за шагом:

  1. удалять node_modules
  2. удалить package-lock.json,
  3. бегать npm --depth 9999 update
  4. бегать npm install

У меня тоже была такая же проблема, эта команда работает для меня

npm i autoprefixer@latest

Он автоматически добавляется потребность в зависимости package.jsonи package-lock.jsonфайл , как показано ниже:

package.json

"autoprefixer": "^9.6.5",

пакет-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"
    },

...

}


Я не совсем уверен, где была моя проблема, но я считаю, что это было потому, что я использовал одни и те же глобальные пакеты как от npm, так и от Yarn.

Я удалил все глобальные пакеты npm, затем при повторном использовании команд yarn проблема исчезла.

Чтобы увидеть установленные глобальные пакеты …

для npm:

npm ls -g --depth=0

для пряжи:

yarn global list

Затем я удалил каждый пакет, который видел в списке npm, используя:

npm uninstall -g <package-name>


На Mac я удалил node_modules и package-lock.json, затем запустил npm install и устранил мою проблему.


Я понизил версию узла с 12 до 10

РЕДАКТИРОВАТЬ

Эта ошибка возникла у меня, потому что я использовал версию узла 12. Когда я перехожу на версию 10.16.5, эта ошибка прекращается. Эта ошибка произошла в моем локальном env, но в prod и staging этого не происходит. В prod и промежуточном узле версия 10.x, поэтому я просто делаю это, и мне не нужно было обновлять какой-либо пакет в моем package.json




Чтобы решить эту проблему, вы можете ввести следующую команду:

‘npm -g обновление’


Если вы используете пряжу:

yarn upgrade

Помогите мне


Минимальное решение, которое сработало для меня в текущем проекте

  • Проект приложения create-react-app
  • Ubuntu / * nix
  • 2020 г.
  • Узел 14.7

удалить node_modules/browserslistкаталог в проекте

сейчас же

npm run build

больше не генерирует это сообщение




В моем случае это нормально работает …

sudo npm i -g browserslist caniuse-lite


Ответы:

Чтобы решить эту проблему, вы можете ввести следующую команду:

‘npm -g update’


Virendra, 17 января 2020 г., 08:39

Удаление node_modules, package-lock.json и npm i решает проблему для меня.


U.A, 1 мая 2020 г., 12:57

Я исправил эту проблему, шаг за шагом:

  1. удалить node_modules
  2. удалить package-lock.json,
  3. беги npm --depth 9999 update
  4. беги npm install

Bartek, 18 мая 2020 г., 13:15

Если вы используете пряжу:

yarn upgrade

Помогите мне


TriSTaR, 22 июня 2020 г., 07:24

Попробуйте это, это решило мою проблему npx browserslist@latest —update-db


Dipanker, 31 июля 2020 г., 16:21

Минимальное решение, которое сработало для меня для текущего проекта

  • Проект создания-реакции-приложения
  • Убунту/*никс
  • 2020
  • Узел 14.7

Удалить каталог node_modules/browserslist в проекте

Сейчас

npm run build

Больше не генерирует это сообщение


Michael, 16 августа 2020 г., 15:26

Многие советуют удалить package-lock.json или yarn.lock. Это явно плохая идея!

Я использую Yarn, и мне удалось исправить эту проблему, удалив только записи caniuse-db и caniuse-lite в моем yarn.lock и выполнив yarn.

Нет необходимости нарушать основную функцию файла блокировки, удаляя его.


Kévin, 16 ноября 2020 г., 12:02

Простое и безопасное решение

Ответ от @Alexandr Nil безопасен и эффективен для меня. Я пишу как полный ответ, потому что его комментарий легко пропустить.

npm --depth 20 update --save caniuse-lite browserslist 

Это хорошо, потому что:

  1. Нет удаления package-lock.json. Удаление этого сделало бы вас уязвимыми для многих пакетов, которые будут обновлены с критическими изменениями, и у вас будет гораздо большая головная боль, чем раньше!

  2. Легко понять, что именно он делает, потому что он явный и очень ограничен в отношении того, что должно быть обновлено.

  3. Это позволяет избежать очень большой глубины 99 или 9999, которая будет работать на некоторых проектах и ​​системах, но не на других. Если вы ограничили глубину слишком маленьким числом, это ничего не сломает. Вы можете увеличить глубину и повторить попытку, пока проект не будет успешно скомпилирован. Я не знаю, действительно ли мне нужно было 20, или я мог бы справиться с меньшей глубиной, например, 5 или 10. Но с глубиной 20 мне понадобилось меньше минуты, чтобы пробежаться.

  4. Это быстро и легко!

Спасибо @Zbyszek за предложение добавить опцию «—save». И да, —depth в настоящее время устарел, но я предполагаю, что они заменят его чем-то другим, а не полностью удалят, поэтому на данный момент это кажется наименее разрушительным подходом.


Eureka, 6 декабря 2020 г., 13:58

Следующие шаги сработали для меня

  1. rm -rf node_modules/
  2. yarn
  3. yarn upgrade caniuse-lite browserlist
  4. перезагрузите сервер и очистите кеш браузера.

Sankeerna, 15 марта 2021 г., 23:52

Существует переменная среды >= 4.5.4, BROWSERSLIST_IGNORE_OLD_DATA, которую вы можете установить, чтобы подавить предупреждение (BROWSERSLIST_IGNORE_OLD_DATA=true). См. коммит Добавьте переменную среды BROWSERSLIST_IGNORE_OLD_DATA..

Вот фрагмент соответствующего кода из этой фиксации, показывающий раннее спасение после проверки этой переменной среды:

module.exports = {
  // ...
  oldDataWarning: function oldDataWarning (agentsObj) {
    if (dataTimeChecked) return
    dataTimeChecked = true
    if (process.env.BROWSERSLIST_IGNORE_OLD_DATA) return

    // ...
    console.warn(
      'Browserslist: caniuse-lite is outdated. ' +
      'Please run next command `' + command + '`'
    )
    // ...
  }
  // ...
}

ggorlen, 25 марта 2021 г., 19:14

Интересные вопросы для изучения

Понравилась статья? Поделить с друзьями:
  • Candy сушильная машина ошибка e14
  • Candy стиральная машина ошибка sp3
  • Candy посудомойка сброс ошибок
  • Candy плита электрическая ошибка l
  • Candy ошибка е08 как исправить