【问题标题】:Error: The target entry-point "@angular/flex-layout" has missing dependencies: - @angular/cdk/bidi错误:目标入口点“@angular/flex-layout”缺少依赖项:-@angular/cdk/bidi
【发布时间】:2021-11-16 21:18:03
【问题描述】:

我试图在 Angular 中添加 flexlayout,但每次我都收到这个错误,我改变了 npm 布局的版本,所以我该如何解决这个问题?

D:\angular\Technia-tech>ng serve
- Generating browser application bundles (phase: setup)...Compiling @angular/flex-layout/core : es2015 as esm2015
D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40
                throw new Error("The target entry-point \"" + invalidTarget.entryPoint.name + "\" has missing dependencies:\n" +
                ^

Error: The target entry-point "@angular/flex-layout" has missing dependencies:
 - @angular/cdk/bidi

    at TargetedEntryPointFinder.findEntryPoints (D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40:23)
    at D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\execution\analyze_entry_points.js:29:41
    at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:28:29)
    at D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:59
    at SyncLocker.lock (D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\locking\sync_locker.js:34:24)
    at SingleProcessExecutorSync.execute (D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:27)
    at Object.mainNgcc (D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\src\main.js:74:25)
    at Object.process (D:\angular\Technia-tech\node_modules\@angular\compiler-cli\ngcc\index.js:29:23)
    at NgccProcessor.processModule (D:\angular\Technia-tech\node_modules\@ngtools\webpack\src\ngcc_processor.js:175:16)
    at D:\angular\Technia-tech\node_modules\@ngtools\webpack\src\ivy\host.js:146:18

> Blockquote

【问题讨论】:

    标签: angular angular-flex-layout


    【解决方案1】:

    尝试通过执行以下命令安装flex-layout 库:

    npm install --save @angular/flex-layout @angular/cdk
    

    然后像下面这样导入它:

    import { FlexLayoutModule } from '@angular/flex-layout';
    
    // ...
    
    @NgModule({
     imports: [ FlexLayoutModule ],
     //...
    });
    

    【讨论】:

      【解决方案2】:

      按照文档的建议,需要使用安装 2 个包

      npm i -s @angular/flex-layout @angular/cdk
      

      请参阅https://github.com/angular/flex-layout#getting-started。这解决了我的问题

      【讨论】:

        猜你喜欢
        • 2023-01-12
        • 1970-01-01
        • 1970-01-01
        • 2021-05-04
        • 2020-05-29
        • 1970-01-01
        • 1970-01-01
        • 2021-10-20
        • 1970-01-01
        相关资源
        最近更新 更多