ngModuleType.ngModuleDef.id 未定义 - 导入 NguCarousel 模块时出现 Angular 8 问题

2024-02-15

当我尝试导入 NguCarousel 模块时,我的应用程序崩溃了,因为ngModuleType.ngModuleDef未定义。如果我注释掉 NguCarousel 模块的导入,该应用程序可以正常工作。 我尝试过更改软件包的版本,但没有成功。目前我已经随 Angular 8 安装了 v1.5.5。

有什么想法为什么这个模块缺少这个属性吗?

js error: enter image description here

包.json

{
  "name": "webapi",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:ssr": "ng run WebApi:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "8.2.12",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "8.2.12",
    "@angular/compiler": "8.2.12",
    "@angular/core": "8.2.12",
    "@angular/forms": "8.2.12",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "8.2.12",
    "@angular/platform-browser-dynamic": "8.2.12",
    "@angular/platform-server": "8.2.12",
    "@angular/router": "8.2.12",
    "@babel/compat-data": "^7.8.0",
    "@fortawesome/angular-fontawesome": "^0.5.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.28",
    "@fortawesome/free-solid-svg-icons": "^5.13.0",
    "@ngu/carousel": "^1.5.5",
    "@nguniversal/module-map-ngfactory-loader": "8.1.1",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^4.4.1",
    "core-js": "^3.3.3",
    "echarts": "^4.9.0",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.4.1",
    "ngx-echarts": "^5.1.2",
    "ngx-spinner": "^9.0.2",
    "oidc-client": "^1.9.1",
    "popper.js": "^1.16.1",
    "rxjs": "^6.5.3",
    "zone.js": "0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.24",
    "@angular/cli": "^8.3.14",
    "@angular/compiler-cli": "8.2.12",
    "@angular/language-service": "8.2.12",
    "@types/jasmine": "~3.4.4",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "~12.11.6",
    "codelyzer": "^5.2.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.4.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "typescript": "3.5.3"
  },
  "resolutions": {
    "@babel/preset-env": "7.5.5"
  },
  "optionalDependencies": {
    "node-sass": "^4.12.0",
    "protractor": "~5.4.2",
    "ts-node": "~8.4.1",
    "tslint": "~5.20.0"
  }
}

应用程序模块.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AccountModule } from './account/account.module';
import { AccountRoutingModule } from './account/account.routing.module';
import { AppComponent } from './app.component';
import { AuthService } from './services/auth.service';
import { NguCarouselModule } from '@ngu/carousel';

@NgModule({
    declarations: [
        AppComponent,
        
    ],
    imports: [
        BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
        NguCarouselModule,
        BrowserAnimationsModule,
        AccountModule,
        AccountRoutingModule,       
        RouterModule.forRoot([
            { path: 'unauthorized', component: UnauthorizedComponent },
            { path: '**', redirectTo: '' }
        ])
    ],
    providers: [
        AuthService,
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }


我今天对于相同的角度版本(v8)遇到了相同的错误。这是由于安装了更高版本的角度材料(v12)引起的,当我注意到我忘记指定我使用卸载它的版本时npm uninstall命令,然后重新安装正确的版本。当我发生错误时。

我的问题的解决方案

  1. 关闭 VS 代码
  2. 转到文件资源管理器上的项目路径
  3. remove node_modules folder
  4. 再次在 VS Code 上打开项目
  5. 运行命令npm i

节点包管理器将为您重新安装具有正确版本的所有包,这应该可以解决问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ngModuleType.ngModuleDef.id 未定义 - 导入 NguCarousel 模块时出现 Angular 8 问题 的相关文章

  • Angular 2 Material 2 日期选择器日期格式

    我不知道如何更改材料2日期选择器的日期格式 我已阅读文档 但我不明白我实际上需要做什么 datepicker默认提供的输出日期格式为f e 6 9 2017 我想要实现的目标是将格式更改为类似的格式9 Jun 2017或任何其他 文档htt
  • Angular with/Angular Material - 对话框主题损坏

    您好 我遇到了 Angular Material 主题在对话框组件中中断的问题 其中文本和其他组件的颜色未按应有的方式工作 在 app component 中 我有一个设置图标按钮来打开对话框 main settings dialog 但当
  • 构建:找不到“节点”的类型定义文件

    VS 2015 社区版 在家 npm 3 10 Angular 2 我试图在 ASP Net MVC 5 应用程序中获取 Angular2 设置 我开始使用的模板使用旧版本的 Angular 因此我更新了包引用 当我构建时 列表中的第一个错
  • 在 Fabric.js 中按宽度/高度在另一个画布对象内居中和缩放画布对象

    Goal 将一个对象 水平和垂直 置于另一个对象 矩形或组 的中心canvas via Fabric js或者通过Javascript保持原始对象的长宽比相同 但也不超过父对象的宽度 高度比例 父对象 矩形或组 不会居中于canvas元素
  • 如何使用深度等于 (Angular 7)

    通过 VS Code 自动导入 import deepEqual require deep equal 不起作用 错误 TS1202 定位时无法使用导入分配 ECMAScript 模块 考虑使用 import as ns from mod
  • Angular 4 过滤器搜索自定义管道

    所以我试图构建一个自定义管道来在 ngFor 循环中执行多个值的搜索过滤器 我花了几个小时寻找一个好的工作示例 其中大多数都是基于以前的版本 并且似乎不起作用 所以我正在构建管道并使用控制台为我提供值 但是 我似乎无法显示输入文本 以下是我
  • 当应用程序位于前台时,Angular 8 firebase 推送通知不起作用

    我正在按照此文档在我的 Angular Web 应用程序上实现 FCM 当我发送通知时 当应用程序未处于活动状态时 它会成功接收 接收后台通知 但如果应用程序处于活动状态 我就不会收到通知 请按照下列步骤操作 https dev to ma
  • Angular 提供的服务在 VS forRoot 中

    我想知道这两个代码块是否等效 我可以用吗providedIn与以下结果相同forRoot Injectable providedIn root export class MyService constructor vs Injectable
  • npmjs.org - 找不到自述文件

    我是 npm 包的主要作者scramjet 一个月以来 我遇到了关于可视性的问题README md在 npmjs 中 The npm 中的超燃冲压发动机包 https www npmjs com package scramjet shows
  • Angular 8 输入验证仅接受数字

    我正在创建动态输入字段 它将接受所有类型值 我需要限制只输入数字 模板 tr tr
  • firebase 和 firebase-admin npm 模块有什么区别?

    我想使用 Firebase 身份验证 数据库和存储 构建 Node js Web 应用程序 但我对应该使用哪个模块感到困惑 firebase or firebase 管理员 或两者 管理 SDK 运行您的代码管理权限 https fireb
  • 如何使用Create React App安装React

    嗨 我对反应真的很陌生 我不知道如何实际安装它 也不知道我需要做什么才能在其中编写代码 我下载了node js并且安装了v12 18 3以及NPM 6 14 6 但是每次我尝试在许多网站上提到的create react app安装方法中输入
  • 无法使用 Nest CLI 创建新项目

    我正在关注this https docs nestjs com first steps创建 Nest 项目的教程 我已经安装了Nest CLI使用这个命令 npm i g nestjs cli 我使用以下命令检查了本地安装的软件包列表 发现
  • 如何将 HTML 字符串从 component.ts 传输到 component.html

    我想问一下如何将HTML格式的字符串从 component ts文件到 component html file 在我的应用程序中有一个布局文件夹 这layout component ts文件有代码 import Component OnIn
  • gulp-sass 5 没有默认的 Sass 编译器;请自行设置

    插件 gulp sass 错误 信息 gulp sass 5 没有默认的 Sass 编译器 请自行设定 这俩sass and node sass包裹是允许的 例如 在你的 gulpfile 中 var sass require gulp s
  • 在 Angular 中使用 Vue 组件

    我有一个用 Vue 构建的项目 我想在 Angular 应用程序中重用 Vue 应用程序中的组件 这样我就不必从头开始重建每个组件 我在medium上看到了这个教程 如何在 Angular 应用程序中使用 Vue 2 0 组件 https
  • Angular 5 - 使用对象进行表单控制

    我目前正在开发一个由 Django 支持的 Angular 应用程序 该应用程序的一部分是它需要显示成员列表 成员数组看起来有点像这样 name John Smith id 3 score set name Jane Doe id 7 sc
  • Plesk Windows 部署 Node.js

    我创建了一个以 Node js 作为后端的 Angular 项目 这是服务器文件结构 Home directory httpdocs node hm dist browser folder server folder server js p
  • 如何使 Angular2 Service 单例?

    我正在尝试在我的应用程序中实现身份验证防护 IE 只有经过身份验证的用户才能访问我的应用程序的某些路由 我正在遵循给出的意见here https angular io docs ts latest guide router html 用户登
  • 在 angular2 中过滤数组

    我正在研究如何在 Angular2 中过滤数据数组 我研究过使用自定义管道 但我觉得这不是我想要的 因为它似乎更适合简单的表示转换 而不是过滤大量数据 数组排列如下 getLogs Array

随机推荐