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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With