繁体   English   中英

Angular7-通过Bitbucket软件包时生产构建失败

[英]Angular7 - Production build fails while going through Bitbucket package

我想构建一个系统,其中可以使用bitBucket在多个应用程序之间重复使用角度分量。

目前,我有以下内容:


在Repo A上,该应用程序可以构建,生产构建,构建库并提供服务。

在存储库B上,该应用程序可以构建并提供服务,但是在生产构建中失败。 这将最终抛出“找不到模块”,但检查node_modules文件夹,我可以验证一切似乎都正常。

在这种情况下,我执行了以下命令:'ng build --prod --verbose'从进程中获取更多信息。 但是我最终得到以下结果:

ERROR in ./node_modules/ng-module-x/dist/lib-module/lib-module.ngfactory.js
Module not found: Error: Can't resolve 'lib-module' in 'C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\ng-module-x\dist\lib-module'
resolve 'lib-module' in 'C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\ng-module-x\dist\lib-module'
Parsed request is a module
using description file: C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\ng-module-x\dist\lib-module\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
looking for modules in C:/Users/joseph.borg/Documents/P Repo/app-x/
using description file: C:\Users\joseph.borg\Documents\P Repo\app-x\package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: C:\Users\joseph.borg\Documents\P Repo\app-x\package.json (relative path: ./lib-module)
    no extension
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\lib-module doesn't exist
    .ts
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\lib-module.ts doesn't exist
    .tsx
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\lib-module.tsx doesn't exist
    .mjs
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\lib-module.mjs doesn't exist
    .js
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\lib-module.js doesn't exist
    as directory
        C:\Users\joseph.borg\Documents\P Repo\app-x\lib-module doesn't exist
C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\ng-module-x\dist\lib-module\node_modules doesn't exist or is not a directory
C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\ng-module-x\dist\node_modules doesn't exist or is not a directory
C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\ng-module-x\node_modules doesn't exist or is not a directory
C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\node_modules doesn't exist or is not a directory
C:\Users\joseph.borg\Documents\P Repo\node_modules doesn't exist or is not a directory
C:\Users\joseph.borg\Documents\node_modules doesn't exist or is not a directory
C:\Users\joseph.borg\node_modules doesn't exist or is not a directory
C:\Users\node_modules doesn't exist or is not a directory
C:\node_modules doesn't exist or is not a directory
looking for modules in C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules
using description file: C:\Users\joseph.borg\Documents\P Repo\app-x\package.json (relative path: ./node_modules)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: C:\Users\joseph.borg\Documents\P Repo\app-x\package.json (relative path: ./node_modules/lib-module)
    no extension
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\lib-module doesn't exist
    .ts
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\lib-module.ts doesn't exist
    .tsx
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\lib-module.tsx doesn't exist
    .mjs
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\lib-module.mjs doesn't exist
    .js
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\lib-module.js doesn't exist
    as directory
        C:\Users\joseph.borg\Documents\P Repo\app-x\node_modules\lib-module doesn't exist

我已经尝试过对该项目进行多次调整,但是构建至今无济于事。

复制步骤:克隆存储库B( https://bitbucket.org/joseph118/app-x/src/master/ )并运行'ng build --prod'。

如果有什么我可以提供的信息,或者可以从头到尾解释一下,请告诉我。

更新了应用程序tsconfig.json并添加了以下配置:

"paths": {
  "data-table": [
    "./node_modules/ng-module-x/dist/lib-module"
  ],
  "data-table/*": [
    "./node_modules/ng-module-x/dist/lib-module/*"
  ]
}

然后更新导入以指向“数据表”,从而解决了该问题。

import { LibModuleModule } from 'lib-module';

资料来源: https : //github.com/angular/angular-cli/issues/13665

暂无
暂无

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

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