繁体   English   中英

错误:找不到模块'@angular/compiler-cli/linker'

[英]Error: Cannot find module '@angular/compiler-cli/linker'

我正在使用 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 ......已经有一段时间没有改变了,所以我不知道为什么这突然不再工作了。 任何提示表示赞赏!

这可能是GitLab-CI 缓存问题。

在您的 Dockerfile 中,查看是否可以添加一些清理命令

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

看看问题是否仍然存在。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM