【问题标题】:How to run ngcc with Angular 11/12如何使用 Angular 11/12 运行 ngcc
【发布时间】:2021-12-22 13:05:06
【问题描述】:

所以我们有一个 monorepo,它有两个使用 Angular 的不同项目。我们还有一个构建管道来自动化集成过程。我遇到的问题是 ngcc 不支持并行执行。我想在并行进程开始之前手动运行 ngcc 命令,但我没找到怎么做?

该项目使用 Angular 11,我在全球范围内安装了 @angular/cli@12.2.1,所以我期待 ngcc 成为那里工具的一部分,但到目前为止还没有运气。我只是收到此错误:-bash: ngcc: command not found

如果有人想知道如果我只是尝试并行运行 ng build 会出现以下错误:

ERROR in ngcc is already running at process with id 2113.
If you are running multiple builds in parallel then you might try pre-processing your node_modules via the command line ngcc tool before starting the builds.
(If you are sure no ngcc process is running then you should delete the lock-file at /Users/runner/work/1/s/frontend/apps/MY_APP/node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__.)

【问题讨论】:

    标签: angular angular-cli angular11 angular12


    【解决方案1】:

    你可以试试: npx ngcc -s path ?

    【讨论】:

    • -s path 是什么?我在其中一个 Angular 项目中尝试了 npx ngcc,但我从 npm 主注册表中得到了 404:404 Not Found - GET https://registry.npmjs.org/ngcc - Not found
    • 愚蠢的问题:您是否在 Angular 项目中运行 npm install?在我的项目中,我可以在 node_modules\.bin\ngcc 中看到
    • 这真是太愚蠢了。我刚刚意识到我正在查看的 Angular 项目中没有 node_modules 。这行得通。
    猜你喜欢
    • 2021-04-30
    • 2022-01-04
    • 1970-01-01
    • 2021-12-17
    • 1970-01-01
    • 1970-01-01
    • 2021-05-22
    • 2021-10-27
    • 2021-10-16
    相关资源
    最近更新 更多