【问题标题】:Not compilable angular library: Unknown error from PostCSS plugin不可编译的角度库:来自 PostCSS 插件的未知错误
【发布时间】:2021-12-31 02:28:55
【问题描述】:

尝试用 Angular 构建新库

ng build some-lib --configuration development

一切正常

但是当我向组件添加一些样式时,示例中默认没有提供

@Component({
  selector: 'lib-some-lib',
  templateUrl: "./some-lib.component.html",
  styleUrls: ["./some-lib.component.scss",]  // <- by default nothing here
})
export class SomeLibComponent {
}

我看到下一个错误:

Building Angular Package

------------------------------------------------------------------------------
Building entry point 'some-lib'
------------------------------------------------------------------------------
⠋ Compiling with Angular sources in Ivy full compilation mode.Compiling @angular/core : es2015 as esm2015
⠸ Compiling with Angular sources in Ivy full compilation mode.Unknown error from PostCSS plugin. Your current PostCSS version is 8.3.11, but postcss-preset-env uses 7.0.39. Perhaps this is the source of the error below.
✖ Compiling with Angular sources in Ivy full compilation mode.
Unknown version 15.1 of safari

【问题讨论】:

    标签: angular angular-library


    【解决方案1】:

    解决方案 1

    经过长时间的调查,我修复了这个错误,我明白我应该将yarn 更改为npm 来解决这个问题。但很高兴知道问题的根本原因。

    解决方案 2

    如果生成新的角度项目,我看不到这样的问题。所以我创建了一个新项目,并将所有文件替换为新项目。还将纱线包管理器设为默认值

    【讨论】:

      猜你喜欢
      • 2021-08-10
      • 1970-01-01
      • 2021-10-19
      • 2017-02-26
      • 2021-06-05
      • 2021-05-20
      • 1970-01-01
      • 2021-03-03
      • 2021-03-13
      相关资源
      最近更新 更多