首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular7 -产品生成在通过Bitbucket包时失败

Angular7 -产品生成在通过Bitbucket包时失败
EN

Stack Overflow用户
提问于 2019-02-12 16:32:07
回答 1查看 70关注 0票数 1

我想要构建一个系统,在这个系统中,可以使用bitBucket在多个应用程序中重用角组件。

目前,我有以下几点:

在Repo A上,应用程序能够构建、生产、构建库和服务。

在Repo B上,应用程序能够构建和服务,但是在生产构建时失败。这将导致抛出‘模块没有找到’,但是检查node_modules文件夹,我可以验证一切似乎都正常。

在本例中,我执行了以下命令:“ng build逐字”,以从流程中获得更多信息。然而,我最终得到了以下结果:

代码语言:javascript
复制
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

我尝试过对项目进行多次调整,但是在构建过程中没有效果。

复制步骤:克隆Repo (https://bitbucket.org/joseph118/app-x/src/master/)并运行“ng build -prod”。

如果有什么我可以提供或解释的从我的结尾,让我知道。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-02-13 13:46:10

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

代码语言:javascript
复制
"paths": {
  "data-table": [
    "./node_modules/ng-module-x/dist/lib-module"
  ],
  "data-table/*": [
    "./node_modules/ng-module-x/dist/lib-module/*"
  ]
}

然后更新导入以指向解决问题的“数据表”。

代码语言:javascript
复制
import { LibModuleModule } from 'lib-module';

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54654664

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档