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:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixernode_modulesbrowserslistindex.js:924:17) at C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixernode_modulesbrowserslistindex.js:252:33 at Array.reduce (<anonymous>) at resolve (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixernode_modulesbrowserslistindex.js:234:18) at browserslist (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixernode_modulesbrowserslistindex.js:353:16) at Browsers.parse (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixerlibbrowsers.js:66:12) at new Browsers (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixerlibbrowsers.js:48:26) at loadPrefixes (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixerlibautoprefixer.js:101:20) at plugin (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrnode_modulesautoprefixerlibautoprefixer.js:112:20) at LazyResult.run (C:Userskaukharegithubngx-group-by-alphabatesnode_modulespostcssliblazy-result.js:295:14) at LazyResult.sync (C:Userskaukharegithubngx-group-by-alphabatesnode_modulespostcssliblazy-result.js:281:26) at LazyResult.warnings (C:Userskaukharegithubngx-group-by-alphabatesnode_modulespostcssliblazy-result.js:85:17) at StylesheetProcessor.process (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrlibng-v5entry-pointresourcesstylesheet-processor.js:47:16) at Object.readResource (C:Userskaukharegithubngx-group-by-alphabatesnode_modulesng-packagrlibtscache-compiler-host.js:73:57) at TsCompilerAotCompilerTypeCheckHostAdapter.loadResource (C:Userskaukharegithubngx-group-by-alphabatesnode_modules@angularcompiler-clisrctransformerscompiler_host.js:495:37) at Object.get (C:Userskaukharegithubngx-group-by-alphabatesnode_modules@angularcompilerbundlescompiler.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" }
Advertisement
Answer
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.