制作Ang服务时出错Angular 4(缺少模块)

问题描述 投票:-2回答:1

我正在尝试使用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: 

/ home / easy / Desktop / wa7shy2 / crm / node_modules / @angular / animations / package.json(相对路径:./ index)无扩展字段'browser'不包含有效的别名配置 /home/easy/Desktop/wa7shy2/crm/src/@angular/animations/browser.ts不存在.js

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

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

angular typescript module
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.