Parcel: BrowserslistError: Unknown version 59 of op_mob

Created on 19 Sep 2020  ยท  22Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

I get the following error when build or serve:

Error: Unknown version 59 of op_mob
BrowserslistError: Unknown version 59 of op_mob
    at Function.select (/home/username/Code/website/node_modules/browserslist/index.js:1101:17)
    at /home/username/Code/website/node_modules/browserslist/index.js:336:33
    at Array.reduce (<anonymous>)
    at resolve (/home/username/Code/website/node_modules/browserslist/index.js:318:18)
    at browserslist (/home/username/Code/website/node_modules/browserslist/index.js:443:21)
    at getTargets (/home/username/Code/website/node_modules/@babel/helper-compilation-targets/lib/index.js:199:48)
    at /home/username/Code/website/node_modules/@babel/preset-env/lib/index.js:258:57
    at /home/username/Code/website/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at getNeededPlugins (/home/username/Code/website/node_modules/@parcel/transformer-babel/lib/env.js:47:33)
    at shouldCompileFurther (/home/username/Code/website/node_modules/@parcel/transformer-babel/lib/env.js:55:31)

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

{
  "name": "The Name",
  "version": "1.0.0",
  "description": "The desc.",
  "scripts": {
    "serve": "parcel serve ./src/index.html --dist-dir ./serve",
    "build": "NODE_ENV=production parcel build ./src/index.html",
    "postbuild": "cp -r static/* dist/"
  },
  "dependencies": {
    "alpinejs": "^2.7.0",
    "smoothscroll-anchor-polyfill": "^1.3.2",
    "smoothscroll-polyfill": "^0.4.4",
    "tailwindcss": "^1.8.10",
    "typeface-fira-sans": "0.0.75",
    "typeface-heebo": "0.0.72"
  },
  "devDependencies": {
    "html-validate": "^3.3.0",
    "parcel": "^2.0.0-beta.1"
  }
}

๐Ÿค” Expected Behavior

Expected Parcel to build and serve

๐Ÿ˜ฏ Current Behavior

Not building or serving rather, errors.

๐Ÿ’ Possible Solution

If I was to guess, maybe browserslist needs an update? Or babel?

๐Ÿ”ฆ Context

I'm unable to build or serve.

I Googled and Issue searched here but, not sure how to address, sorry.

๐Ÿ’ป Code Sample

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | ^2.0.0-beta.1
| Node | v14.6.0
| npm/Yarn | 6.14.7
| Operating System | Manjaro Linux

โœ–๏ธ Non-Parcel bug โœจ Parcel 2

Most helpful comment

In my case downgrading only browserslist for yarn does not help, I had to downgrade also caniuse-lite.

"resolutions": {
  "browserslist": "4.14.2",
  "caniuse-lite": "1.0.30001129"
}

All 22 comments

Are you sure this is a valid browserslist query? Isn't accepted by https://browserslist.dev either...

To solve it, at least temporarily, you can exclude the op_mob 59 by adding a extra rule to .browserslistrc
The extra rule is: not op_mob 59

My .browserslistrc file that avoid this issue is the next:

last 4 version
> 2%
not dead
IE 11
not op_mob 59

Thanks for the replies!

I guess I don't understand why I'm getting this error. I've never touched anything browserlist related before and it's always worked fine. I did install a few libs and removed them afterwards, once I realized they weren't what I was looking for etc. This included deleting .parcel-cache, package-lock.json and node_modules (npm install) etc. but, again, not sure I understand why this is popping up out of the blue, as that's never been an issue before.

In fact, I've never even had a .browserlistrc before and all was fine (maybe I should have had one either way but, I'm not sure why the error.)

Anyway, thanks for the suggestions. I'll keep digging (or give those a try.)

Well, adding the .browserlistrc and the not op_mod 59 (I used your exact code) didn't help :-(

The alternative would have been updating browserslist/caniuse/... but you already did that...

package-lock.json and node_modules

Any chance you could provide a full code sample (repository?) so that I can reproduce the error?

That's great! Thank you.

I've added you as a contributor. I'll commit these latest changes that I've made, including the .browserlistrc.

I should add, it's failing production build on Netlify as well, for whatever that's worth.

I encountered the same. I tried many variants of browserlist config, parcel v1/v2, local/global, yarn/npm, delete all the caches, etc. No luck, have to switch to Snowpack for now.

I tried running npm run serve outside of VS Code, just to see if it or one of it's extensions had something to do with it. Same error.

I see 18 instances of browserlist in the package-lock.json file, ranging from 4.0.0 on up to 4.14.3, which is the version Browerlist is at itself.

Looks like Browserlist was updated only 2 days ago:

https://github.com/browserslist/browserslist/releases

Would reverting back to 4.14.2 do anything? Not sure how about doing that but, the release was release around the same time I started getting this error.

Maybe I should post this up over there as well?

So apparently, this is caused by

  "browserslist": [
    "last 2 versions",
    "> 1%",
    "ie > 8",
    "not dead"
  ],

in this package.json in the smoothscroll-anchor-polyfill package.

Passing that to Browserslist to get the actual versions, the result is

import browserslist from "browserslist";

browserslist([ 'last 2 versions', '> 1%', 'ie > 8', 'not dead' ])
/*
[
  'and_chr 85',        'and_ff 79',
  'and_qq 10.4',       'and_uc 12.12',
  'android 81',        'baidu 7.12',
  'chrome 85',         'chrome 84',
  'edge 85',           'edge 84',
  'firefox 80',        'firefox 79',
  'ie 11',             'ios_saf 14.0',
  'ios_saf 13.4-13.7', 'ios_saf 13.3',
  'ios_saf 12.2-12.4', 'kaios 2.5',
  'op_mini all',       'op_mob 59',
  'opera 70',          'opera 69',
  'safari 14',         'safari 13.1',
  'samsung 12.0',      'samsung 11.1-11.2'
]
*/

That is then passed to Babel which again calls browserslist(...)...

Downgrading browserslist doesn't seem to help.

But I would say this is a browserslist bug

Wow, thanks so much for doing this!

I wish I knew how to debug stuff like this, that's awesome!

I temporarily fixed the issue with yarn:
add this to package.json

  "resolutions": {
    "parcel/browserslist": "4.14.2"
  }

and then yarn

In my case downgrading only browserslist for yarn does not help, I had to downgrade also caniuse-lite.

"resolutions": {
  "browserslist": "4.14.2",
  "caniuse-lite": "1.0.30001129"
}

Thanks guys!

I can confirm on Parcel V2 (2.0.0-beta.1) @SolomoN-ua's solution worked and kirzka's did not.

I should note that I installed Browserlite 4.14.2 directly in dependencies but, that didn't work. Good call on the cainuse-lite.

Of course, being new, I wasn't aware there was a resolutions field. Looks like it's only for Yarn, which I've been considering switching to.

Yarn Selective Version Resolutions

There does, however, appear to be a package that adds this feature to NPM (not sure I had it setup properly, as I was unable to get this to work; the Yarn Resolutions did work, however.)

NPM Force Resolutions

Anyway, thanks again!

P.s. the awesome @mischnic is making progress on this over at Browserlist:

https://github.com/browserslist/browserslist/issues/537

Looks like it's going to be addressed, which is awesome.

And there is also another possible temporary work around (so far hasn't worked for me on Parcel V2, however):

https://github.com/browserslist/browserslist/issues/537#issuecomment-695764493

I use npm install and fixed. i add this script to package.json.

"scripts": {
  "preinstall": "npx npm-force-resolutions"
},
"resolutions": {
  "browserslist": "4.14.2",
  "caniuse-lite": "1.0.30001129"
}

thanks https://github.com/parcel-bundler/parcel/issues/5164#issuecomment-695793929

This is fixed in Browserslist 4.14.4.

$ parcel serve ./src/index.html
โ„น๏ธ Server running at http://localhost:1234
๐Ÿšจ Build failed.
Error: Unknown version 85 of edge
BrowserslistError: Unknown version 85 of edge
at Function.select (/Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/index.js:1101:17)
at /Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/index.js:336:33
at Array.reduce ()
at resolve (/Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/index.js:318:18)
at browserslist (/Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/index.js:443:21)
at getTargets (/Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/node_modules/@babel/helper-compilation-targets/lib/index.js:204:48)
at /Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/node_modules/@babel/preset-env/lib/index.js:258:57
at /Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
at getNeededPlugins (/Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/lib/env.js:47:33)
at shouldCompileFurther (/Users/spec/Documents/GitHub/icowan/react-kjxq/node_modules/@parcel/transformer-babel/lib/env.js:55:31)

the same question:
Error: Unknown version 85 of edge

manual update browserslist to 4.14.5
image
@mischnic

Still having the issue too with 4.14.7
Error: Unknown version 72 of opera with config in .browserlistrc:

> 0.1%
last 3 versions
not dead

I had to do:

"resolutions": {
  "browserslist": "4.14.7"
},

manual update browserslist to 4.14.5

Adding a dependency doesn't neccessarily update the version that other dependencies use.

I had to do: "resolutions"

That means:

  1. either you didn't tell Yarn to upgrade the version in the lockfile (but it was possible according to the version range required by some packages)
  2. some package has a hardcoded version range, something like "browserslist": "4.14.0", in which case that clause really is neccessary.

Edit .browswerslist file to

defaults
not op_mob > 1

then, error disappeared.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Znarkus picture Znarkus  ยท  38Comments

shiloa picture shiloa  ยท  39Comments

jpergler picture jpergler  ยท  59Comments

mattdesl picture mattdesl  ยท  43Comments

bbugh picture bbugh  ยท  84Comments