如何在Angular 8 ASP.NET中解决此生成错误

如何在Angular 8 ASP.NET中解决此生成错误,angular,visual-studio,build-error,Angular,Visual Studio,Build Error,我发现此错误,无法找到模块'@angular/core'。在这方面寻求帮助,虽然有问题,但对我毫无帮助 这是否与错误的版本导入有关?在我运行的命令窗口中 L:\NetProject\BooksProject\BooksProject\ClientApp>ng生成 并得到相同的错误 BooksProject> BooksProject> fail: Microsoft.AspNetCore.SpaServices[0] BooksProject> ERROR in

我发现此错误,无法找到模块'@angular/core'。在这方面寻求帮助,虽然有问题,但对我毫无帮助

这是否与错误的版本导入有关?在我运行的命令窗口中

L:\NetProject\BooksProject\BooksProject\ClientApp>ng生成

并得到相同的错误

BooksProject> 
BooksProject> fail: Microsoft.AspNetCore.SpaServices[0]
BooksProject>       ERROR in ../../../node_modules/@angular/cdk/bidi/typings/dir-document-token.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/bidi/typings/dir.d.ts(8,59): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/bidi/typings/directionality.d.ts(8,41): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/text-field/typings/autofill.d.ts(9,69): error TS2307: Cannot find module '@angular/core'.
BooksProject>       ../../../node_modules/@angular/cdk/text-field/typings/autofill.d.ts(10,28): error TS2307: Cannot find module 'rxjs'.
BooksProject>       ../../../node_modules/@angular/cdk/text-field/typings/autosize.d.ts(8,71): error TS2307: Cannot find module '@angular/core'.
BooksProject> 
如果我在“获取浏览器”窗口中调试应用程序时只显示文本, “无法获取/”

我删除了node_modules文件夹并安装了npm

我根据@HariniP的建议运行命令,谢谢

角向/核心处的npm i

这是输出,我需要修复所有这些警告吗

L:\NetProject\BooksProject\BooksProject\ClientApp>npm i @angular/core
npm WARN @angular/material@7.3.7 requires a peer of @angular/cdk@7.3.7 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@8.1.0-next.1 requires a peer of @angular/animations@8.1.0-next.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@8.1.0-next.1 requires a peer of @angular/common@8.1.0-next.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@8.1.0-next.1 requires a peer of @angular/compiler@8.1.0-next.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@8.1.0-next.1 requires a peer of @angular/core@8.1.0-next.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@8.1.0-next.1 requires a peer of @angular/platform-browser@8.1.0-next.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@8.1.0-next.1 requires a peer of @angular/platform-browser-dynamic@8.1.0-next.1 but none is installed. You must install peer dependencies yourself.
npm WARN The package protractor is included as both a dev and production dependency.
npm WARN The package ts-node is included as both a dev and production dependency.
npm WARN The package tslint is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @angular/core@8.0.0
updated 1 package and audited 19503 packages in 33.58s
found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

L:\NetProject\BooksProject\BooksProject\ClientApp>

使用命令安装angular
npm i@angular/core

在您的项目目录中。

我通过添加以下内容修复了我的问题:

True

True您在那之后尝试过构建吗?我从VS中清理并重建项目,然后得到构建:1成功,0失败,0最新,0跳过-没有错误,但从windows命令提示符我得到这个初始错误,当我调试runOk时,VS Build成功,您能在浏览器中查看应用程序吗?浏览器仅显示“无法获取/”,它不会在Startup.cs中加载我的组件。我可以在ConfigureServices中放置一个断点,并且程序会停止正常运行。加载大约60秒后打开浏览器时,会出现此初始错误,浏览器中唯一可见的错误是左上角的“无法获取/”