You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 9执行ng build时出现CUSTOM_ELEMENTS_SCHEMA命名导出错误的求助

Angular 9执行ng build时出现CUSTOM_ELEMENTS_SCHEMA命名导出错误的求助

我在尝试用 ng build 命令构建我的Angular 9项目时,碰到了一个异常错误,具体提示如下:

An unhandled exception occured: Named export 'CUSTOM_ELEMENTS_SCHEMA' not found.
The requested module '@angular/compiler' is a commonjs module which may not support all module.exports as named exports.
Common JS modules can always be imported via the default export, for example using

错误提示里给出了这样的导入建议:

import pkg from '@angular/compiler'
const {CUSTOM_ELEMENTS_SCHEMA,NO_ERRORS_SCHEMA}=pkg;

我在Stack Overflow社区里看到有其他用户也遇到过类似问题,找了对应的解决方案尝试了,但对我的情况没用。我也按照上面这个提示的方式修改了代码,还是没能解决这个问题。

有没有大佬能给我一些思路或者建议呀?

备注:内容来源于stack exchange,提问作者Virender Thakur

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 11:42:33