【问题标题】:Getting error for not having node installed yet it is installed由于尚未安装节点而出现错误
【发布时间】:2021-04-06 14:55:46
【问题描述】:

尝试使用 dotnet 核心后端运行 spa 应用程序并在 Mac OS 上的 Visual Studios 中运行反应前端时发生错误。 这似乎是 Visual Studios 错误

这是错误

Error: Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE.

这是csproj文件的相关部分

<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
    <!-- Ensure Node.js is installed -->
    <Exec Command="node --version" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>
    <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
    <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
  </Target>

这一行特别是抛出错误

    <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />

当我输入 node --version我得到v15.5.0

此外,当我在命令行中使用dotnet run 运行应用程序时,应用程序运行得非常好。有谁知道如何解决这个问题?

【问题讨论】:

    标签: node.js visual-studio .net-core single-page-application


    【解决方案1】:

    这个错误可能是我最近将 Mac OS 升级到 Big Sur 11.1 造成的。我需要做的就是更新 VS 并修复此错误。

    【讨论】:

      猜你喜欢
      • 2020-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      • 2021-04-14
      • 2020-08-16
      • 2018-08-16
      • 2011-02-21
      相关资源
      最近更新 更多