无法确定组件角度为5的模块 [英] cannot determine the module for component angular 5

查看:72
本文介绍了无法确定组件角度为5的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用"ng build --prod"构建Angular应用程序时出现以下错误.当我使用Angular 4进行构建并遇到Angular 5时出现错误时,这是​​正常的.在Angular 5中,"ng serve"可以正常工作.

I'm getting following error when I build the Angular app using "ng build --prod". This is working when I build with Angular 4 and getting error with Angular 5. With Angular 5 "ng serve" is working perfectly.

错误中的

错误:无法在mypath/node_modules/time-ago-pipe/time-ago-pipe.ts中确定类TimeAgoPipe的模块!将TimeAgoPipe添加到NgModule中进行修复.

ERROR in Error: Cannot determine the module for class TimeAgoPipe in mypath/node_modules/time-ago-pipe/time-ago-pipe.ts! Add TimeAgoPipe to the NgModule to fix it.

https://www.npmjs.com/package/time-ago上出错-管道

任何解决方案吗?

推荐答案

检查大小写

import { MyComponent } from "./User/my-component";

在我的情况下,问题是在导入语句中使用U作为大写字母创建了文件夹用户.但是实际上在磁盘上是小写的.当我在导入语句中将文件夹重命名为user(小写)时,它也对我有用.

In my case, the problem was that the folder user was created with U as capital in my import statement. But actually on disk it was in small case. When I renamed the folder to user (with u lower case) in my import statement also, it worked for me.

import { MyComponent } from "./user/my-component";

因此,请检查您的导入路径是否区分大小写.

这篇关于无法确定组件角度为5的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆