Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 使ng服务角度为4时出错(缺少模块)_Angular_Typescript_Module - Fatal编程技术网

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

Angular 使ng服务角度为4时出错(缺少模块),angular,typescript,module,Angular,Typescript,Module,我试图使用ng serve在浏览器中打开我的项目,但每次我运行该命令时,都会出现以下错误 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

我试图使用ng serve在浏览器中打开我的项目,但每次我运行该命令时,都会出现以下错误

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: 
/home/easy/Desktop/wa7shy2/crm/node_modules/@angulation/animations/ package.json(相对路径:./index)无扩展名 “浏览器”字段不包含有效的别名配置
/home/easy/Desktop/wa7shy2/crm/src/@angular/animations/browser.ts 不存在。js

我很确定模块已经安装,我自己检查了路径,找到了所有表示找不到的文件,尝试卸载并再次安装,仍然是相同的问题,有人告诉我这里出了什么问题


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

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

您使用的是angular 4还是5?因为你的标题是4,但你的命令将安装最新版本的动画,即5.2.75.2.7,我检查了package.json,它说平台浏览器和动画是5.2.7,但angular是5.0.0。它不工作,这就是为什么我发布一个问题-谢谢你的大力支持-你用CLI命令生成应用程序了吗?你能和我们分享你的angular cli和tsconfig文件吗?似乎有一个错误的配置