天道酬勤,学无止境

BrowserslistError: Unknown version 67 of android

I have created one angular library using angular 8 and CLI 8. I am trying to build the library, but I am getting the error.

ng build <lib-name>

I have gone through some questions posted related to this error, most of them say remove node_modules and reinstall them. I tried this solution but still, I am getting the following error.

[Browserslist] Could not parse package.json. Ignoring it.

ERROR: Unknown version 67 of android
Unknown version 67 of android
BrowserslistError: Unknown version 67 of android
        at Function.select (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\node_modules\browserslist\index.js:924:17)
        at C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\node_modules\browserslist\index.js:252:33
        at Array.reduce (<anonymous>)
        at resolve (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\node_modules\browserslist\index.js:234:18)
        at browserslist (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\node_modules\browserslist\index.js:353:16)
        at Browsers.parse (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\lib\browsers.js:66:12)
        at new Browsers (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\lib\browsers.js:48:26)
        at loadPrefixes (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\lib\autoprefixer.js:101:20)
        at plugin (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\node_modules\autoprefixer\lib\autoprefixer.js:112:20)
        at LazyResult.run (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\postcss\lib\lazy-result.js:295:14)
        at LazyResult.sync (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\postcss\lib\lazy-result.js:281:26)
        at LazyResult.warnings (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\postcss\lib\lazy-result.js:85:17)
        at StylesheetProcessor.process (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\lib\ng-v5\entry-point\resources\stylesheet-processor.js:47:16)
        at Object.readResource (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\ng-packagr\lib\ts\cache-compiler-host.js:73:57)
        at TsCompilerAotCompilerTypeCheckHostAdapter.loadResource (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\@angular\compiler-cli\src\transformers\compiler_host.js:495:37)
        at Object.get (C:\Users\kaukhare\github\ngx-group-by-alphabates\node_modules\@angular\compiler\bundles\compiler.umd.js:26490:94)

What can be the issue? Is this error is due to autoprefixer? What should I do to solve this issue?

package-lock.json

"ng-packagr": {
      "version": "5.5.1",
      "resolved": "https://registry.npmjs.org/ng-packagr/-/ng-packagr-5.5.1.tgz",
      "integrity": "sha512-GT6QK5WAirQwALdeJPiXdgRd5PzRqcknb/C/G+cCDEbUFri4oGVmns2Nl4I0FGg/cRn6nXTxRiUunOSqZ3Lehw==",
      "dev": true,
      "requires": {
        "ajv": "^6.10.2",
        "autoprefixer": "^9.6.0",
        "browserslist": "^4.0.0"
},
    "autoprefixer": {
      "version": "9.5.1",
      "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.5.1.tgz",
      "integrity": "sha512-KJSzkStUl3wP0D5sdMlP82Q52JLy5+atf2MHAre48+ckWkXgixmfHyWmA77wFDy6jTHU6mIgXv6hAQ2mf1PjJQ==",
      "dev": true,
      "requires": {
        "browserslist": "^4.5.4",
        "caniuse-lite": "^1.0.30000957",
        "normalize-range": "^0.1.2",
        "num2fraction": "^1.2.2",
        "postcss": "^7.0.14",
        "postcss-value-parser": "^3.3.1"
      }

评论

The thing that solved it for me was running

npx browserslist --update-db

in project root. This made changes to package-lock.json updating versions of caniuse-lite.

To give some context, I landed on this question because I was getting this error:

Compiling TypeScript sources through ngc
ERROR: Unknown version 80 of android
An unhandled exception occurred: Unknown version 80 of android

after I upgraded angular from 9.x.x to 10.x.x. I was getting this error both on my dev machine and in CI, so removing node_modules and package-lock.json was not really an option.

I'm seeing this too... like you, deleting node_modules and re-running npm install did not work.

What did work, however, was deleting node_modules AND deleting package-lock.json, and then running npm i.

Try that...

Andrew

Try this:

1.Deleting the entire node_modules directory.

2.Deleting package-lock.json from the root directory.

3.Making sure the latest @angular-devkit projects were referenced in package.json:

"@angular-devkit/build-angular": "^0.801.3", "@angular-devkit/build-ng-packagr": "^0.801.3".

4.Close and reopen cmd window.

Running npm install.

This might be too late, but I'm gonna post how I solved the issue, because I ran into it very recently (late Feb. 2022), and I followed a different approach that resulted in minimal changes to my project.
I had a similar issue with a project downloaded from StackBlitz, but in my case the unknown version of android was 97 instead of 67 or 80.
The browserslist database was up to date, deleting the node_modules directory and running npm install did not change anything (checked by using a comparison tool), updating the project's dependencies caused even more trouble, and so did deleting package-lock.json.

What worked in my case was specifying 98 as the target version of android (instead of 97) in .browserslistrc in the project's root directory (I actually had to create that file, as it didn't exist).

This is how I found out that version 98 works:
I first temporarily edited the code where the exception occurred (in node_modules\browserslist\index.js). Right before the line that throws the exception, I inserted this statement:

if (name === 'android') {
  return arguments.callee(context, name, (version - 1).toString())
}

to find the largest number less than 97 that is accepted. Then I ran npx browserslist and found that version to be 4.
Dissatisfied, I tried larger version numbers by replacing the above snippet with this one:

if (name === 'android' && Number(version) < 200) {
  return arguments.callee(context, name, (Number(version) + 1).toString())
}

and fortunately, 98 worked (verified by running npx browserslist again).
So I undid my changes to the code, grabbed that output from npx browserslist, and saved it in .browserslistrc (I also had to exclude safari due to another bug).
The ng build command then proceeded successfully.

Try to modify \node_modules\ng-packagr\node_modules\autoprefixer\node_modules\browserslist\index.js at row 924 as follow:

if (alias) {
      version = alias
    } else if (context.ignoreUnknownVersions) {
      return []
    } else {
      throw new BrowserslistError(
        'Unknown version ' + version + ' of ' + name)
    }

in

if (alias) {
      version = alias
    } else if (context.ignoreUnknownVersions) {
      return []
    } else {
      return []
    }

I hope help you... this is dirty solution...

Can be caused by outdated babel. Try update babel using npx babel-upgrade --write and then npx browserslist@latest --update-db.

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • BrowserslistError:未知的浏览器专业(BrowserslistError: Unknown browser major)
    问题 我正在尝试在我的角度安装中使用 bootstrap 4。 我已经运行 npm install --save bootstrap@next 但我在运行时有休息: ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","plugins":[null,null,null],"sourceMap":false}!./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser major at error (C:\xampp\htdocs\tick_master_angular\web\node_modules\browserslist\index.js:37:11) at Function.browserslist.checkName (C:\xampp\htdocs\tick_master_angular\web\node_modules\browserslist\index.js:320:18) at Function.select (C:\xampp
  • BrowserslistError: Unknown browser major
    I'm trying to use bootstrap 4 with my angular installation. i've run npm install --save bootstrap@next but i have a break at runtime : ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","plugins":[null,null,null],"sourceMap":false}!./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser major at error (C:\xampp\htdocs\tick_master_angular\web\node_modules\browserslist\index.js:37:11) at Function.browserslist.checkName (C:\xampp\htdocs\tick_master_angular\web\node_modules
  • Ionic4 未知浏览器查询(Ionic4 Unknown browser query)
    问题 我经常练习 Ionic,所以这些问题对我来说并不新鲜,但我无法解决这个问题。 我目前正在尝试将我的 Ionic3 项目迁移到 Ionic4。 为此,我创建了一个新的 Ionic4 选项卡项目。 每次我尝试 Ionic serve 命令时,我都会得到:[ng] 发生未处理的异常:未知的浏览器查询 basedir=$(dirname "$(echo "$0" | sed -e 's Maybe you are using old Browserslist or made typo in query. [ng] See "C:\Users\Admin\AppData\Local\Temp\ng-9er5Id\angular-errors.log" for further details. [ERROR] ng has unexpectedly closed (exit code 127). The Log file: [error] BrowserslistError: Unknown browser query `basedir=$(dirname "$(echo "$0" | sed -e 's`. Maybe you are using old Browserslist or made typo in query. at unknownQuery (D:\Wisex
  • Angular 5 with Bootstrap 4 not working
    I created a new Angular 5 project. After that I followed instructions given on Angular CLI GitHub page to use Bootstrap 4.0.0 with Angular 5.2.2. I use 'npm install bootstrap' to install bootstrap. but I get... Unknown error from PostCSS plugin. Your current PostCSS version is 6.0.15, but autoprefixer uses 5.2.18. Perhaps this is the source of the error below. ... ... ERROR in ./node_modules/css-loader? {"sourceMap":false,"importLoaders":1}!./node_modules/postcss- loader/lib{"ident":"postcss","sourceMap":false}!./node_modules/bootstrap/ dist/css/bootstrap.min.css Module build failed
  • 带有 Bootstrap 4 的 Angular 5 不起作用(Angular 5 with Bootstrap 4 not working)
    问题 我创建了一个新的 Angular 5 项目。 之后,我按照 Angular CLI GitHub 页面上的说明使用 Bootstrap 4.0.0 和 Angular 5.2.2。 我使用“npm install bootstrap”来安装引导程序。 但我得到... Unknown error from PostCSS plugin. Your current PostCSS version is 6.0.15, but autoprefixer uses 5.2.18. Perhaps this is the source of the error below. ... ... ERROR in ./node_modules/css-loader? {"sourceMap":false,"importLoaders":1}!./node_modules/postcss- loader/lib{"ident":"postcss","sourceMap":false}!./node_modules/bootstrap/ dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser major ... ... webpack: Failed to compile. 回答1
  • Ionic4 Unknown browser query
    I have practised Ionic a lot so these Problems are not new for me but I am unabale to solve this one. I am currently trying to migrate my Ionic3 project to Ionic4. To do this I have created a new Ionic4 tabs project. Every time I try the Ionic serve command I am getting: [ng] An unhandled exception occurred: Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's Maybe you are using old Browserslist or made typo in query. [ng] See "C:\Users\Admin\AppData\Local\Temp\ng-9er5Id\angular-errors.log" for further details. [ERROR] ng has unexpectedly closed (exit code 127). The Log file:
  • 2021-06-09
    使用脚手架创建angular项目时遇到的问题 1、执行ng serve --open时出现错误:BrowserslistError: Unknown browser query dead 解决方法: 在package.json中添加如下配置项即可 "browserslist": [ "last 1 version", "> 1%", "IE 10" ], 2、ERROR in E:/web/my-app/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference’ directive syntax. 解决方法: 找到node_modules/@types/node/index.d.ts (20,1)文件,将里面的三斜杠///都转为双斜杠// 3、Port 4200 is already in use. Use ‘–port’ to specify a different port. 产生错误原因,端口冲突 解决方法: 1)方法1:执行下述命令,更换端口号,这里是4211,其他的也可以 ng serve --port 4211 2)方法2:关闭正在占用 4200 端口的 Angular 程序,来释放 4200 端口 输入 netstat -a -n -o 找到端口号是 4200 的,并记住对应的 PID 输入
  • Getting unknown property 'classpath' with Jack compiler for Android
    I am trying to compile my project with the next Jack compiler. I just updated Android Studio to 2.2-Beta and my gradle plugin to 2.14.1. Here's my gradle file: buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-beta1' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { project -> if(project.name.endsWith("-schema")) { apply plugin: 'com.github
  • 使用适用于 Android 的 Jack 编译器获取未知属性“类路径”(Getting unknown property 'classpath' with Jack compiler for Android)
    问题 我正在尝试使用下一个 Jack 编译器编译我的项目。 我刚刚将 Android Studio 更新到 2.2-Beta 并将我的 gradle 插件更新到 2.14.1。 这是我的gradle文件: buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-beta1' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } subprojects { project -> if(project.name.endsWith("-schema")) { apply plugin: 'com.github.jacobono.jaxb' dependencies { jaxb 'com.sun.xml.bind:jaxb-xjc
  • react-native 启动报告:Error: UNKNOWN: unknown error, open ...\.babel.json(react-native start report: Error: UNKNOWN: unknown error, open …\.babel.json)
    问题 我在 Windows 7 上有一个 RN 开发环境。它工作正常,直到昨天它在我运行“react-native”启动后突然报告错误。 错误信息: [2016-12-26 09:58:17] HMR Server listening on /hot React packager ready. fs.js:557 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: UNKNOWN: unknown error, open 'C:\Users\xitao\.babel.json' at Object.fs.openSync (fs.js:557:18) at Object.fs.writeFileSync (fs.js:1222:33) at save (C:\RN\LearnRN\node_modules\babel-register\lib\cache.js:45:16) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) fs.js:557 return
  • Latest Google Play Services 9.6.80 cause “FirebaseCrash: Failed to initialize crash reporting”
    Notice the latest version when the App is installed fresh, with FirebaseCrash enabled, the App took quite a while (over a minute to start)... and end up with the following crash. Removing firebase crash library from the app help improve the time. 09-14 14:31:08.880 26747 26747 E FirebaseCrash: Failed to initialize crash reporting 09-14 14:31:08.880 26747 26747 E FirebaseCrash: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference 09-14 14:31:08.880 26747 26747 E FirebaseCrash: at bol.<init>(:com.google
  • 最新的 Google Play 服务 9.6.80 导致“FirebaseCrash:无法初始化崩溃报告”(Latest Google Play Services 9.6.80 cause “FirebaseCrash: Failed to initialize crash reporting”)
    问题 请注意当应用程序全新安装时的最新版本,启用 FirebaseCrash,应用程序花了很长时间(超过一分钟才能启动)......并最终导致以下崩溃。 从应用程序中删除 firebase 崩溃库有助于缩短时间。 09-14 14:31:08.880 26747 26747 E FirebaseCrash: Failed to initialize crash reporting 09-14 14:31:08.880 26747 26747 E FirebaseCrash: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference 09-14 14:31:08.880 26747 26747 E FirebaseCrash: at bol.<init>(:com.google.android.gms.DynamiteModulesC:3201) 09-14 14:31:08.880 26747 26747 E FirebaseCrash: at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl
  • Android FusedLocation Runtime Permission from MainActivity
    I am having trouble using FusedLocationAPI runtime permissions. I have a class named LocationServiceApi in which handles location Here is my LocationService.java public class LocationServiceApi implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,LocationListener{ private Context mContext; public GoogleApiClient mGoogleApiClient; private LocationRequest mLocationRequest; MainActivity mainActivity; public LocationServiceApi(Context context){ this.mContext = context; creteGoogleApiClient(); createLocationRequest(); } public void getLastLocation() {
  • Android Studio error when clicking on Android device monitor
    I am having this error in android studio whenever i click on Android Device Monitor: --------------------------- Monitor --------------------------- An error has occurred. See the log file C:\Users\<user>\AppData\Local\Android\android-studio\sdk\tools\lib\monitor-x86_64\configuration\1413432754457.log. --------------------------- Aceptar --------------------------- And the log file contains this: !SESSION 2014-10-15 23:12:34.229 ----------------------------------------------- eclipse.buildId=unknown java.version=1.7.0_67 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86
  • Android 10: GATT error with 133 - how fix?
    I have android app. I use BLE(Bluetooth low energy) for connect to devices. It is work good, but I have issue on Android 10. This is my code: Hashtable<String, BluetoothDevice> myHtDevices; .... BluetoothGatt gatt = myHtDevices.get(deviceId).connectGatt(this, false, gattCallback); in onConnectionStateChange I get: //public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState){ status= 133, newStatus =0, I have this issue only Android Q. I tried this method(add param TRANSPORT_LE), but it not work: if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q){
  • Chrome与chromedriver版本对应
    ChromeDriver 版本Chrome版本 2.44(修复了2.43的bug)v69-v71 2.43v69-v71 2.42v68-v70 2.41v67-v69 2.40v66-v68 2.39v66-v68 2.38v65-v67 2.37v64-v66 2.36v63-v65 2.35v62-v64 2.34v61-v63 2.33v60-v62 chromedriver下载地址:chromedriver下载更多版本见下面----------ChromeDriver v2.43 (2018-10-16)----------Supports Chrome v69-71Resolved issue 2537: Parsing of proxy configuration is not standard compliant [[Pri-1]]Resolved issue 2607: Launch App command is flaky [[Pri-2]]Resolved issue 2575: Screenshot of element inside iFrame is taken incorrectly [[Pri-2]]Resolved issue 1855: Feature request : ChromeDriver to support window
  • Android 谷歌地图 V2 停止(Android Google Map V2 Stopped)
    问题 我正在尝试构建地图应用程序并逐步遵循此链接。 我在这里找到了类似的主题,但没有帮助我。 我想显示地图,但是当我运行它时,它返回强制关闭和我的 android 设备。 我看到很多关于这个错误的问题,但没有人真正回答我的问题。 这是我的 LogCat: 03-21 20:55:57.476: D/AndroidRuntime(4090): Shutting down VM 03-21 20:55:57.476: W/dalvikvm(4090): threadid=1: thread exiting with uncaught exception (group=0x417692a0) 03-21 20:55:57.500: E/AndroidRuntime(4090): FATAL EXCEPTION: main 03-21 20:55:57.500: E/AndroidRuntime(4090): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapandroid/com.example.mapandroid.MainActivity}: android.view.InflateException: Binary XML file line #11: Error
  • Error in SWT/LogCat? or Android 2.2 AVD
    Based on a tip, I changed the target of my Android app from 2.3 to 2.2. Out of the frying pan and into the fire! Now my app won't even open (in the 2.2 emulator) and I get this (seems to be an SWT problem, and then an android/LogCat problem): eclipse.buildId=M20110909-1335 java.version=1.7.0_01 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.java.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product Error Thu Nov 24 16:06:47 CST 2011
  • 未在基本xml属性上声明该属性(Android)(The attribute is not declared (Android) on basic xml attributes)
    问题 我是这个Android开发的新手,我发现它的布局确实令人困惑。 我试图在视图上显示背景图像,并且尝试使用此示例在XML Android中添加背景图像以成形,但它看起来非常糟糕(您知道的位图) 所以我认为矢量可能很有趣。 唯一的问题是我连正式的例子都无法使用。 我尝试将其设置为背景 <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="256dp" android:width="256dp" android:viewportWidth="32" android:viewportHeight="32"> <path android:fillColor="#8fff" android:pathData="M20.5,9.5 c-1.955,0,-3.83,1.268,-4.5,3 c-0.67,-1.732,-2.547,-3,-4.5,-3 C8.957,9.5,7,11.432,7,14 c0,3.53,3.793,6.257,9,11.5 c5.207,-5.242,9,-7.97,9,-11.5 C25,11.432,23.043,9.5,20.5,9.5z" />
  • SWT/LogCat 中的错误? 或 Android 2.2 AVD(Error in SWT/LogCat? or Android 2.2 AVD)
    问题 根据提示,我将 Android 应用程序的目标从 2.3 更改为 2.2。 从煎锅中出来,进入火中! 现在我的应用程序甚至无法打开(在 2.2 模拟器中),我得到了这个(似乎是 SWT 问题,然后是 android/LogCat 问题): eclipse.buildId=M20110909-1335 java.version=1.7.0_01 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.java.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product Error Thu Nov 24 16:06:47 CST 2011 Unhandled event loop exception org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at