简体   繁体   English

dotnet core 便携式 angular 应用程序未运行

[英]dotnet core portable angular app not running

I've downloaded Node v12.8.1 binaries aswell as Dotnet core 3.0.100 Binaries.我已经下载了 Node v12.8.1 二进制文件以及 Dotnet core 3.0.100 二进制文件。 I set the environment variables for windows manually (for this user, as i do not have admin rights).我手动设置了 windows 的环境变量(对于这个用户,因为我没有管理员权限)。 I managed to get a isolated angular app running, a isolated node.js helloworld.js and a dotnet core mini api.我设法让一个隔离的 angular 应用程序运行,一个隔离的 node.js helloworld.js 和一个 dotnet core mini api。

All of that worked so far.到目前为止,所有这些都奏效了。 Now i tried to create a dotnet core angular app using dotnet new angular and it created a couple of boilerplate including a "ClientApp" folder which includes the angular client application.现在我尝试使用dotnet new angular创建一个 dotnet core angular 应用程序,它创建了几个样板,包括一个“ClientApp”文件夹,其中包括 angular 客户端应用程序。

Without changing anything i simply tried to run dotnet run and i got an error stating that "node --version" was terminated with exit code 1 and在没有更改任何内容的情况下,我只是尝试运行dotnet run ,但我收到一条错误消息,指出“node --version”以退出代码 1 终止,并且

error: Node.js is required to build and run this project.错误:构建和运行此项目需要 Node.js。 To continue, please install Node.js from https://nodejs.org/ , and then restart your command prompt or IDE.要继续,请从https://nodejs.org/安装 Node.js,然后重新启动命令提示符或 IDE。

Now what i was thinking is that somehow dotnet core tries to find node js using System environment path instead of user environment path.现在我在想的是,dotnet core 以某种方式尝试使用系统环境路径而不是用户环境路径来查找节点 js。 I am not sure about this however.但是,我不确定这一点。

Does anyone know how i can solve or bypass this issue?有谁知道我可以如何解决或绕过这个问题?

Yes, you have to remove the Node.js version check in the .csproj of your project.是的,您必须在项目的.csproj中删除 Node.js 版本检查。 I mean this part:我的意思是这部分:

<!-- 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." />

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

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