【问题标题】:Trying to Run Angular 9 Web Project in Visual Studio尝试在 Visual Studio 中运行 Angular 9 Web 项目
【发布时间】:2021-12-13 20:45:31
【问题描述】:

这是我的第一个 Angular 项目。我可以运行“npm start”,它启动时没有错误。以下是我从 Visual Studio 运行应用程序时当前遇到的错误。看起来它发送相同的命令,但我每次都会收到这 2 个“失败”错误。它打开浏览器,什么也不做。

信息:Microsoft.Hosting.Lifetime[0] 现在收听:https://localhost:5001

信息:Microsoft.Hosting.Lifetime[0] 现在收听:http://localhost:5000

信息:Microsoft.Hosting.Lifetime[0] 申请开始。按 Ctrl+C 关闭。

信息:Microsoft.Hosting.Lifetime[0] 托管环境:开发

信息:Microsoft.Hosting.Lifetime[0] 内容根路径:C:\Users\CF135238\source\repos\COT.DEV.Forf\Forf

失败:Microsoft.AspNetCore.SpaServices[0] (node:7664) [DEP0111] DeprecationWarning: 访问 process.binding('http_parser') 已弃用。

失败:Microsoft.AspNetCore.SpaServices[0] (使用node --trace-deprecation ... 显示警告的创建位置)

【问题讨论】:

  • 您必须使用 IIS Express 配置文件启动调试程序。并且无需自己运行npm start。 Web 应用程序会为您执行此操作。
  • 我明白这一点 - 但是当我从 IISExpress 运行时,我收到了我发布的错误。如果我手动运行 npm start ,则 CLI 没有错误。

标签: c# angular npm


【解决方案1】:

版本兼容性可能是您的问题。我遇到了这个问题,将 node js 版本从 16.8.0 降级到 14.17.5 解决了我的问题。

我还建议您使用 Visual Studio 以外的其他 IDE,因为它可能不适合 Angular 等前端项目。 Webstorm 和 Visual Studio Code 非常适合 Angular 项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-04
    • 2017-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多