【问题标题】:NG Build fail in Azure DevOps pipline : Error: Cannot find module '../internal/operators/audit'Azure DevOps 管道中的 NG 构建失败:错误:找不到模块“../internal/operators/audit”
【发布时间】:2019-10-06 18:12:46
【问题描述】:

我正在尝试为 Angular 项目配置 Azure CI/CD

下面是 azure pipeline 的截图:

包.json

构建项目抛出以下错误:

2019-05-20T09:19:18.0252202Z > ng build
2019-05-20T09:19:18.0252697Z     ^
2019-05-20T09:19:18.0253091Z 
2019-05-20T09:19:18.0253456Z 
2019-05-20T09:19:18.0254242Z Error: Cannot find module '../internal/operators/audit'
2019-05-20T09:19:18.0254971Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-05-20T09:19:18.0255650Z     at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-05-20T09:19:18.0256280Z     at Module.require (internal/modules/cjs/loader.js:637:17)
2019-05-20T09:19:18.0257011Z     at require (internal/modules/cjs/helpers.js:22:18)
2019-05-20T09:19:18.0257814Z     at Object.<anonymous> (D:\a\1\s\IoTConnectAI\node_modules\@angular-devkit\schematics\node_modules\rxjs\operators\index.js:3:15)
2019-05-20T09:19:18.0258514Z     at Module._compile (internal/modules/cjs/loader.js:701:30)
2019-05-20T09:19:18.0259140Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
2019-05-20T09:19:18.0259776Z     at Module.load (internal/modules/cjs/loader.js:600:32)
2019-05-20T09:19:18.0260390Z     at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
2019-05-20T09:19:18.0264689Z     at Function.Module._load (internal/modules/cjs/loader.js:531:3)
2019-05-20T09:19:18.0265336Z npm ERR! code ELIFECYCLE
2019-05-20T09:19:18.0265959Z npm ERR! errno 1
2019-05-20T09:19:18.0266569Z npm ERR! sconnectai@0.0.0 build: `ng build`
2019-05-20T09:19:18.0267438Z npm ERR! Exit status 1
2019-05-20T09:19:18.0268063Z npm ERR! 
2019-05-20T09:19:18.0268686Z npm ERR! Failed at the sconnectai@0.0.0 build script.
2019-05-20T09:19:18.0270422Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-20T09:19:18.0271137Z 

试过 ng build --prod

请帮我解决这个问题

【问题讨论】:

  • 错误信息是找不到模块'../internal/operators/audit'。你调查过那个错误吗?
  • @DanielMann 是的,我已经调查了错误,但没有找到任何解决方案。当我在本地机器上构建相同的代码时,它的构建成功,所以我不确定 azure devops 出了什么问题。
  • @DanielMann 当我在 package.json 中添加包 "rxjs": "^6.5.1" 时出现上述错误

标签: angular azure-devops


【解决方案1】:

尝试使用 npm 命令构建项目的问题的根本原因 npm 运行构建

ng build 无法正常工作,并且由于尝试使用 npm 工具而给出没有此类命令的错误。

在 Azure DevOps 管道中添加命令行任务并使用 ng build 构建项目

它工作正常并成功构建项目

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-03
    • 2020-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-10
    • 1970-01-01
    相关资源
    最近更新 更多