使ng服务时出错Angular 4(缺少模块)

时间:2018-03-04 08:17:26

标签: angular typescript module

我正在尝试使用ng服务在浏览器中打开我的项目,但每次运行命令时,都会给我以下错误。

ERROR in ./node_modules/@angular/platform-browser/esm5/animations.js
Module not found: Error: Can't resolve '@angular/animations' in 
'/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/platform-
browser/esm5'
resolve '@angular/animations' in 
'/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/platform-
browser/esm5'
Parsed request is a module
using description file: 
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/platform-
browser/package.json (relative path: ./esm5)
Field 'browser' doesn't contain a valid alias configuration
after using description file: 
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/platform-
browser/package.json (relative path: ./esm5)
resolve as module
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/platform-
browser/esm5/node_modules doesn't exist or is not a directory
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/platform-
browser/node_modules doesn't exist or is not a directory
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/node_modules 
doesn't exist or is not a directory
/home/easy/Desktop/wa7shy2/crm/node_modules/node_modules doesn't exist 
or is not a directory
/home/easy/Desktop/wa7shy2/node_modules doesn't exist or is not a 
directory
/home/easy/Desktop/node_modules doesn't exist or is not a directory
/home/easy/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /home/easy/Desktop/wa7shy2/crm/node_modules
using description file: /home/easy/Desktop/wa7shy2/crm/package.json 
(relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: 
/home/easy/Desktop/wa7shy2/crm/package.json (relative path: 
./node_modules)
using description file: 
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/animations/
package.json (relative path: .)
no extension
Field 'browser' doesn't contain a valid alias configuration          
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/animations is not 
a file.ts
Field 'browser' doesn't contain a valid alias configuration          
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/animations.ts 
doesn't exist.js
Field 'browser' doesn't contain a valid alias configuration          
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/animations.js 
doesn't exist
as directory
existing directory
using path: 
/home/easy/Desktop/wa7shy2/crm/node_modules/@angular/animations/index
using description file: 

/家庭/易/桌面/ wa7shy2 / CRM / node_modules / @角/动画/    package.json(相对路径:./ index)没有扩展名    字段“浏览器”不包含有效的别名配置
   /home/easy/Desktop/wa7shy2/crm/src/@angular/animations/browser.ts    不存在.js

我很确定该模块已安装,自行检查路径并找到所有未找到的文件,尝试卸载并再次安装,仍然是同样的问题,有人告诉我这里有什么问题。

我正在使用命令npm install @ angular / animations @ latest --save

进行安装

1 个答案:

答案 0 :(得分:0)

我解决了我的问题,@ angular / animations文件夹是空的,所以我将备份@angular文件夹中丢失的文件复制到其中,现在它运行良好。