简体   繁体   English

查看错误 VisualStudio 2019 Angular 8

[英]View errors VisualStudio 2019 Angular 8

How to view errors in an Angular 8 project?如何查看 Angular 8 项目中的错误? The output and the browser do not make out what is happening.输出和浏览器不知道发生了什么。 Errors are not displayed anywhere else.错误不会在其他任何地方显示。 Browser error:浏览器错误:

在此处输入图片说明 . .

VisualStudio output: VisualStudio 输出:

在此处输入图片说明 . .

Try cleaning Cache and Node_module.尝试清理 Cache 和 Node_module。

Follow below steps按照以下步骤操作

  1. Delete node_modules folder & package-lock.json in your application.删除应用程序中的 node_modules 文件夹和 package-lock.json。
  2. Clear cache npm cache clean --force清除缓存npm cache clean --force
  3. Run NPM install npm install运行npm install

Hope this helps.希望这可以帮助。

Looks like you are setting a different port when serving the application.看起来您在为应用程序提供服务时设置了不同的端口。

The default port is 4200 .默认端口是4200 to set a different port you should use --port portNumber要设置不同的端口,您应该使用--port portNumber

in your package.json file remove extra quotes from --port and 1576 .在您的 package.json 文件中,从--port1576删除额外的引号。 it should be like this应该是这样的

ng lint && ng serve --port 1576

Run npm install to make sure your node modules are up to date.运行npm install以确保您的节点模块是最新的。

If you see any error regarding node module please fix that.如果您看到有关节点模块的任何错误,请修复该错误。

you can also use ng serve to serve the application or ng serve -o to serve and open in the browsers.您还可以使用ng serve为应用程序ng serve服务,或使用ng serve -o在浏览器中提供服务和打开服务。

if you want to change default port from 4200 to 4400 then run ng serve --port 4400如果要将默认端口从 4200 更改为 4400,则运行ng serve --port 4400

if your package.json file has scripts like this.如果你的 package.json 文件有这样的脚本。

"scripts": {
    "start": "ng lint && ng serve --port 1576"
}

then you can also serve the application with npm run start然后您还可以使用npm run start为应用程序提供服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM