Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserslistError: Unknown version 59 of op_mob #5164

Closed
Natetronn opened this issue Sep 19, 2020 · 22 comments
Closed

BrowserslistError: Unknown version 59 of op_mob #5164

Natetronn opened this issue Sep 19, 2020 · 22 comments
Labels
✖️ Non-Parcel bug Bugs related to dependencies or plugins ✨ Parcel 2

Comments

@Natetronn
Copy link

Natetronn commented Sep 19, 2020

🐛 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
@mischnic
Copy link
Member

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

@Sam10F
Copy link

Sam10F commented Sep 19, 2020

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

@Natetronn
Copy link
Author

Natetronn commented Sep 19, 2020

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.)

@Natetronn
Copy link
Author

Natetronn commented Sep 19, 2020

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

@mischnic
Copy link
Member

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

package-lock.json and node_modules

@mischnic
Copy link
Member

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

@Natetronn
Copy link
Author

Natetronn commented Sep 19, 2020

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.

@rpggio
Copy link

rpggio commented Sep 19, 2020

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.

@Natetronn
Copy link
Author

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?

@mischnic
Copy link
Member

mischnic commented Sep 19, 2020

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

@mischnic mischnic added ✖️ Non-Parcel bug Bugs related to dependencies or plugins and removed 🕐 Waiting labels Sep 19, 2020
@mischnic
Copy link
Member

I've opened a browserslist issue: browserslist/browserslist#537

@Natetronn
Copy link
Author

Natetronn commented Sep 19, 2020

Wow, thanks so much for doing this!

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

@krizka
Copy link

krizka commented Sep 20, 2020

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

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

and then yarn

@SolomoN-ua
Copy link

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

@Natetronn
Copy link
Author

Natetronn commented Sep 20, 2020

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:

browserslist/browserslist#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):

browserslist/browserslist#537 (comment)

yoursunny added a commit to yoursunny/NDNts-NFD-status-page that referenced this issue Sep 20, 2020
@gavin-c-tcg
Copy link

gavin-c-tcg commented Sep 21, 2020

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 #5164 (comment)

@mischnic
Copy link
Member

This is fixed in Browserslist 4.14.4.

@SpectatorNan
Copy link

$ 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

@SpectatorNan
Copy link

manual update browserslist to 4.14.5
image
@mischnic

@darkylmnx
Copy link

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

@mischnic
Copy link
Member

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.

@oti
Copy link

oti commented Nov 30, 2020

Edit .browswerslist file to

defaults
not op_mob > 1

then, error disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✖️ Non-Parcel bug Bugs related to dependencies or plugins ✨ Parcel 2
Projects
None yet
Development

No branches or pull requests

10 participants