【问题标题】:Unable to build Angular project in Alpine Linux无法在 Alpine Linux 中构建 Angular 项目
【发布时间】:2022-02-15 13:02:14
【问题描述】:

我最近将我的项目迁移到 Angular 13。它在我的 Mac 上本地构建,但是当我在我的 Docker 构建容器中运行它时它开始失败(在本地和我们的 CI/CD 服务器上进行了测试。

它在抱怨 DeckGL 导入:

Cannot find module '@deck.gl/layers' or its corresponding type declarations.

1 import * as Layers from '@deck.gl/layers';

Cannot find module '@deck.gl/geo-layers' or its corresponding type declarations.

2 import * as GeoLayers from '@deck.gl/geo-layers';

Cannot find module '@deck.gl/aggregation-layers' or its corresponding type declarations.

3 import * as AggregationLayers from '@deck.gl/aggregation-layers';

我使用npm list 来确保我的 Mac 和 Alpine 容器中的依赖项相同,并且还使用相同的 Node 版本进行了测试(并且尝试了几个不同的 Node / Apline 图像),但是,问题仍然存在,但仍在本地工作。

有什么可能导致这种情况的想法吗?

【问题讨论】:

    标签: node.js angular docker webpack alpine


    【解决方案1】:

    真的很愚蠢的问题,但发布答案以防将来有人遇到类似问题。

    我不小心在顶级目录中运行了npm install,并且安装了一些没有出现在我的package.json 文件中的Node 模块。在我的例子中,我在 package.json 中安装了核心 deck.gl 模块,但没有任何层包(它们是单独的 npm 模块)。

    当我在本地运行它时,它找到了正确的依赖关系,但是在 CI/CD 环境中运行它时,它显然失败了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 2021-11-23
      • 2019-03-17
      • 2021-06-14
      • 2018-05-25
      相关资源
      最近更新 更多