我用角CLI 13.0.4创建了一个新的角应用程序。它创建了一个角形应用程序版本~13.0.0。当我使用命令ng build时,会得到以下错误:
./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"以下是我使用的不同版本:

我应该做些什么来修复这个错误?
浏览器列表文件的内容:
# 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发布于 2022-03-06 22:12:01
我从last 2 Safari major versions文件中注释掉了行.browserslistrc。npm build正在成功构建应用程序。
发布于 2022-03-30 09:08:53
尝试npm audit fix或npm audit fix --force,因为“错误:无效版本:”15.2-15.3“此错误是由于安装的无效版本造成的,因此,由于npm@6审计修复中引入了此错误,因此将自动解决依赖问题。
发布于 2022-03-04 19:23:12
在更新了npm audit fix --force之后,我不得不运行.browserslistrc,它对我起了作用。
https://stackoverflow.com/questions/71322252
复制相似问题