asp.net - 角度问题 - 无法获取 /
问题描述
我在 Visual Studio 2017 中运行一个ASP.NET Core
应用程序Angular
。不幸的是,每当我运行该项目时,它都会在浏览器中显示以下消息:
Cannot GET /
经过几个小时的谷歌搜索(示例链接),我尝试了以下操作,并在 tsconfig.json 文件中添加:
"lib": [ "es5", "es6", "es2017", "dom" ]
在我的情况下,这是早些时候如下:
"lib": [ "es2017" ]
虽然项目构建成功,但它几乎没有错误如下:
Severity Code Description Project File Line Suppression State
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ASP.NETCoreWithAngular C:\Users\Amit's-PC\source\repos\ASP.NETCoreWithAngular\ASP.NETCoreWithAngular\ClientApp\node_modules\@angular\common\src\directives\ng_class.d.ts 48 Active
Severity Code Description Project File Line Suppression State
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ASP.NETCoreWithAngular C:\Users\Amit's-PC\source\repos\ASP.NETCoreWithAngular\ASP.NETCoreWithAngular\ClientApp\node_modules\@angular\core\src\change_detection\differs\default_keyvalue_differ.d.ts 24 Active
Severity Code Description Project File Line Suppression State
Error TS2585 (TS) 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ASP.NETCoreWithAngular C:\Users\Amit's-PC\source\repos\ASP.NETCoreWithAngular\ASP.NETCoreWithAngular\ClientApp\node_modules\rxjs\Observable.d.ts 58 Active
我在这里错过了什么?任何想法将不胜感激。
解决方案
从您收到的错误消息看来,您的默认配置很可能JavaScript
是 ises5
或以下任何其他配置es2015
。这意味着您正在尝试使用es2015
功能,而您的编译器现在允许您使用。检查您的 IDE 配置并确保您的JavaScript
配置设置为至少es2015
推荐阅读
- c# - 将方法作为参数传递时,Blazor 中的“@MethodName”和“MethodName”之间的区别?
- wix - Wixtoolset - 支持在 Logo 和 LogoFile 主题中显示 Ratina
- macos - 如何使我的应用程序安装程序成为 Mac OS(Catalina) 中受信任的应用程序?
- typescript - 在打字稿中递归转换对象树的所有叶子
- transloadit - 带有 transloadit 的旋转圆圈。是否可以使用水印或图像旋转?
- drupal - 在 Gatsby GraphQL 查询中努力过滤 Drupal 数据
- javascript - 为什么在Vue中甚至存在inheritAttrs?
- javascript - JS - 用同名的变量替换所有出现的字符串
- python - 使用引导带在注释部分插入新行(Python - Django)
- sql - 在 ORACLE 中将列移动到新表