相关疑难解决方法(0)

angular 9 库发布错误“尝试发布已由 Ivy 编译的包”

我将我的angular 8.x.x项目迁移到angular 9.x.x,当我尝试发布我的库时,它失败并显示以下错误

npm 错误!@candiman/website@9.0.0 prepublishOnly:node --eval "console.error('ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\nPlease delete and rebuild the package, without compiling with Ivy, before attempting to publish.\n')" && exit 1

有什么变化吗 angular 9

angular-cli angular angular-library angular-cli-v9

28
推荐指数
5
解决办法
1万
查看次数

Angular Build - 未捕获的类型错误:无法读取未定义的属性“id”

我已经成功地将我的 angular 应用程序构建为开发版本。我还没有将它作为生产构建完成,因为它给了我一些错误,我只需要测试开发构建。

开发构建过程顺利,没有错误或任何东西。然后我使用 nginx docker 容器中 dist 文件夹中的文件来托管文件。

问题是什么都没有显示,但是一个白页,在控制台中我收到一条错误消息“未捕获的类型错误:无法读取未定义的属性 id”。下面的完整消息似乎没有指向我写的任何内容,我已经在网上搜索了几个小时,但找不到关于此问题的任何内容。

在此处输入图片说明

我尝试了一些不同的东西,例如运行我手动阅读的“npx ivy-ngcc”编译了一些东西。无论如何,我是否可以获得有关错误的更多详细信息,以查看它是否是我所做的?

更新 因此,我恢复了在 main.ts 中注释掉的行,如下面的评论中所述。我还按照建议尝试了 'ng build --aot',它向我展示了一系列错误,这些错误似乎都与所使用的 devextreme 组件有关。当我使用来自 github 的 devextreme angular starter 项目开始该项目时,我觉得这很奇怪。

我收到如下消息:

  1. 'dx-scroll-view 不是有效的 HTML 元素'

  2. “node_modules/devextreme-angular/ui/drawer.d.ts - 错误:出现在 SideNavOuterToolbarModule 的 NgModule.imports 中,但无法解析为 NgModule 类”

node.js webpack angular-cli angular

17
推荐指数
2
解决办法
1万
查看次数

出现在 AppModule 的 NgModule.imports 中,但无法解析为 angular 8 中的 NgModule 类

node_modules/@angular/common/http/http.d.ts:2801:22 中的错误 - 错误 NG6002:出现在 AppModule 的 NgModule.imports 中,但无法解析为 NgModule 类

2801 export declare class HttpClientModule {
Run Code Online (Sandbox Code Playgroud)

angular8

17
推荐指数
5
解决办法
4万
查看次数

多个模块中的管道重用,NG6007(由多个 NgModule 声明)或 NG6002(无法解析为 NgModule 类),

我的管道位于apps\administrator\src\app\modules\messenger\pipes\custom-message.pipe.ts

import { Pipe, PipeTransform } from '@angular/core';

/**
 * Pipe for Custom Message for boolean
 */
@Pipe({
  name: 'customMessage',
})
export class CustomMessagePipe implements PipeTransform {
  public transform(value: boolean, trueString: string, falseString: string): string {
    //The code
  }
}
Run Code Online (Sandbox Code Playgroud)

在主模块apps\administrator\src\app\app.module.ts文件中:

import { CustomMessagePipe } from './modules/messenger/pipes/custom-message.pipe';
...
@NgModule({
  declarations: [..., CustomMessagePipe],
  providers: [...],
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)

现在,我有两个FormSmsModule模块FormSmtpModule

FormSmsModule位于apps\administrator\src\app\modules\messenger\form-sms

FormSmtpModule位于apps\administrator\src\app\modules\messenger\form-smtp

按照这个答案/sf/answers/4372816381/

在数组上使用的文件apps\administrator\src\app\modules\messenger\form-sms\form-sms.module.ts中,我有:CustomMessagePipeimports

import …
Run Code Online (Sandbox Code Playgroud)

module typescript angular-pipe angular

14
推荐指数
1
解决办法
1万
查看次数

错误NG6002:出现在AppModule的NgModule.imports中,但本身有错误

我在本地和建筑项目中有 Angular 12,它运行良好,没有任何错误。

我的本地设置:

Angular CLI: 12.0.5  
Node: 12.16.3  
Package Manager: npm 6.14.4  
OS: win32 x64  
Angular: 12.0.5
Run Code Online (Sandbox Code Playgroud)

但是,当在 Linux 服务器上构建我的项目时,它给出了这个错误,没有什么可处理的。

服务器设置:

Angular CLI: 12.0.5  
Node: 14.18.1  
Package Manager: npm 6.14.15  
OS: linux x64  
Angular: 12.0.5
Run Code Online (Sandbox Code Playgroud)
Error: src/app/app-routing.module.ts:34:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors  
34 export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

应用程序模块.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } …
Run Code Online (Sandbox Code Playgroud)

javascript node.js typescript angular angular12

12
推荐指数
1
解决办法
7万
查看次数

Angular 无法获取/

我想启动一个 angular 项目我已经安装了 angular/cli 并且我已经创建了该项目ng new mon-premier-projet 但是当我开始服务时ng serve我收到这个错误

node_modules/@angular/router/router.d.ts:2631:22 - error NG6003: Appears in the NgModule.exports of AppRoutingModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (@angular/router) which declares RouterModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors …
Run Code Online (Sandbox Code Playgroud)

angular

0
推荐指数
1
解决办法
2054
查看次数