Nyalab / caniuse-api

request the caniuse data to check browsers compatibilities
MIT License
356 stars 27 forks source link

BrowserslistError: Unknown version 66 of android #75

Closed sylvainpolletvillard closed 6 years ago

sylvainpolletvillard commented 6 years ago

I just upgraded my version of browserslist to 3.2.8, and now I have this error in my tests:

Error {
    browserslist: true,
    message: 'Unknown version 66 of android',
    name: 'BrowserslistError',
  }

  Function.select (node_modules/caniuse-api/node_modules/browserslist/index.js:622:17)
  node_modules/caniuse-api/node_modules/browserslist/index.js:151:33
  resolve (node_modules/caniuse-api/node_modules/browserslist/index.js:132:18)
  browserslist (node_modules/caniuse-api/node_modules/browserslist/index.js:224:16)
  Object.isSupported (node_modules/caniuse-api/dist/index.js:62:37)
  module.exports (dist/main.js:49:34)

from this code:

const browsers = browserslist(options.browsers);
let isFallbackNeeded = !caniuse.isSupported("css-grid", browsers);

This already happened before. I think it is due to the browserslist version used by caniuse-api being out of date, possibly because of the package-lock.json file: https://github.com/Nyalab/caniuse-api/blob/master/package-lock.json#L862

If I rollback to the same version of browserslist, the problem is gone. But I would like to be up to date if possible. Do you know how to always use the latest version of browserslist by caniuse-api ?

sylvainpolletvillard commented 6 years ago

I note that you upgraded to browserslist v3 in the last commits: https://github.com/Nyalab/caniuse-api/commit/7e57b2d0b4ac749e1a5c74c2d1c1b78518262ec3 ; but it doesn't seem there was a new release since. Do you plan to release it in a new version ?

mo commented 6 years ago

This is a pretty high impact bug. Everyone who upgrades to css-loader 1.0 and still wants CSS minification needs to install the latest version of cssnano; and if you install these package, then you hit the error "BrowserslistError: Unknown version 67 of android".

I'm no expert, but I believe these errors happen because the caniuse-api package is using and old version of "browserslist" and has not set the ignoreUnknownVersions flag.

See details here: https://github.com/cssnano/cssnano/issues/537

Nyalab commented 6 years ago

ok, i am looking into it

Nyalab commented 6 years ago

this should be fixed with the 3.0.0 release, let me know if the bug is still there now