【问题标题】:Error: Cannot find module '@angular/compiler-cli/linker'错误:找不到模块'@angular/compiler-cli/linker'
【发布时间】:2021-10-16 08:00:32
【问题描述】:

我正在使用 gitlab 从 Angular 应用程序构建 Docker 映像。这总是工作得很好,但由于某种原因,从昨天开始构建中断

RUN node_modules/.bin/ng build --configuration=staging

带有以下错误消息:

    Compiling @angular/material/grid-list : es2015 as esm2015
    (node:1) UnhandledPromiseRejectionWarning: TypeError: angularCompiler.getDiagnosticsForFile is not a function
        at /opt/ng/node_modules/@ngtools/webpack/src/ivy/plugin.js:390:60
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    ✔ Browser application bundle generation complete.
    Warning: /opt/ng/src/environments/environment.test.ts is part of the TypeScript compilation but it's unused.
    Add only entry points to the 'files' or 'include' properties in your tsconfig.
    ./src/main.ts - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js):
    Error: Cannot find module '@angular/compiler-cli/linker'

tsconfig、main.ts、package.json、Dockerfile ... 已经有一段时间没有更改了,所以我不知道为什么这突然不再起作用了。任何提示表示赞赏!

【问题讨论】:

    标签: angular dockerfile gitlab-ci


    【解决方案1】:

    可能是GitLab-CI caching 问题。

    在你的Dockerfile中,看看是否可以添加some cleanup commands

    RUN npm cache clean --force && \
    rm -r node_modules && \
    npm uninstall angular-cli && \
    npm install --save-dev @angular/cli@latest && \
    

    然后看看问题是否仍然存在。

    【讨论】:

      猜你喜欢
      • 2021-11-01
      • 2018-02-04
      • 2020-05-25
      • 1970-01-01
      • 2019-07-03
      • 2020-11-21
      • 2018-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多