'How to find the angular Invalid version 15.2-15.3 error?
I created a new angular app with the angular CLI 13.0.4. It created an angular app version ~13.0.0. When I use the command ng build
, I get the following error:
./node_modules/css-loader/dist/runtime/api.js - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Transform failed with 1 error:
error: Invalid version: "15.2-15.3"
./node_modules/css-loader/dist/runtime/noSourceMaps.js - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Transform failed with 1 error:
error: Invalid version: "15.2-15.3"
These are the different version that I use:
What should I do to fix this error?
------ UPDATE 3/2/2022 ------
Contents of the browserlist file:
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
Solution 1:[1]
I commented out the line last 2 Safari major versions
from the .browserslistrc
file. The npm build
is building the application successfully.
Solution 2:[2]
Try npm audit fix
or npm audit fix --force
since "error: Invalid version: "15.2-15.3"" this error is due to an invalid version installed, therefore as this was introduced in npm@6 audit fixing will automatically resolve dependence issues.
Solution 3:[3]
I had to run npm audit fix --force
after updating .browserslistrc
, and it worked for me.
Solution 4:[4]
I removed the last two Safari major versions from the .browserslistrc
file after which the build is created successfully.
After removing the last two Safari major versions:
Solution 5:[5]
The command "npm audit fix" works for me
Solution 6:[6]
I got this problem after updating my browserslist, and npm update
fixed it for me.
As explained here by an Angular collaborator:
This is just a bug in the parsing logic of Safari browser versions
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | wonderful world |
Solution 2 | Jasper |
Solution 3 | H. Pauwelyn |
Solution 4 | Ethan |
Solution 5 | YDY |
Solution 6 | eta32carinae |