问题描述
我在ASP.Net Core应用程序中使用Microsoft.AspNetCore.NodeServices 1.1.1
.一切正常,但是现在我在新计算机上,并出现以下错误:
I'm using Microsoft.AspNetCore.NodeServices 1.1.1
in my ASP.Net Core application. Everything has been working fine, but now I'm on a new computer and I get the following error:
System.InvalidOperationException:
Failed to start Node process. To resolve this:.
[1] Ensure that Node.js is installed and can be found in one of the PATH directories.
Current PATH enviroment variable is: ....
Make sure the Node executable is in one of those directories, or update your PATH.
[2] See the InnerException for further details of the cause.
我从这个问题中删除了路径变量,但是其中列出了安装Node的目录.
I have removed the path variables from this question, but the directory where Node is installed is listed in there.
node -v
给了我v6.11.0
,所以它被添加到了路径中.
node -v
in a terminal gives me v6.11.0
so it is added to the path.
自上次工作以来,代码中的任何内容都没有改变,只有我的计算机.有人知道什么地方可能出问题吗?
Nothing in the code has changed since it last worked, only my computer. Does anyone know what could be wrong?
推荐答案
调试后,我发现这是由于缺少文件夹造成的.
After debugging I found out that it was due to a missing folder.
这是在Startup.cs
中配置NodeServices
的方式:
services.AddNodeServices(options =>
{
options.ProjectPath = "Path\That\Doesnt\Exist";
});
一旦我添加了该路径,一切都会正常运行.
Once I added that path, everything runs okay.
这篇关于Microsoft.AspNetCore.NodeServices:无法启动节点进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!