Visual Studio 2017 - Node。JS服务器进程-关闭?

时间:2021-06-19 03:29:53

I'm working on a ASP.NET App in Visual Studio 2017 and I'm noticing a Node.JS: Server-side Javascript process running at 1.3GB to 1.8GB of memory. My IIS worker process is the normal size it is in VS 2015.

我在做ASP。Visual Studio 2017的NET应用,我注意到一个节点。JS:服务器端Javascript进程运行在1.3GB到1.8GB内存。我的IIS worker进程是VS 2015的正常大小。

My app doesn't include any Node.JS libraries. I'm not able to figure out how to turn this Node.JS: Server-side Javascript process off. It's eating up too much memory for something I have no use for.

我的应用不包含任何节点。JS库。我不知道如何旋转这个节点。服务器端Javascript进程停止了。它占用了太多的内存,而我对它毫无用处。

Is there a way to kill this aside from uninstalling VS 2017 and switching back to VS 2015?

除了卸载VS 2017和切换到VS 2015之外,还有什么方法可以消除这个问题吗?

Visual Studio 2017 - Node。JS服务器进程-关闭?

Killing the main Process in Task Manager doesn't affect anything in VS, however if I go to the Details tab and kill the the individual running processes it crashes Visual Studio. I took a video of what happened after I killed the process and ran my local web page (Sorry for the quality, SO limited image size to 2MB):

在任务管理器中杀死主进程不会影响VS中的任何内容,但是如果我打开Details选项卡并杀死运行的进程,它会导致Visual Studio崩溃。我拍了一段视频,讲述了在我关闭进程后发生的事情,并运行了我的本地网页(不好意思,图片大小限制在2MB):

Visual Studio 2017 - Node。JS服务器进程-关闭?

7 个解决方案

#1


112  

Tools > Options > Text Editor > JavaScript/TypeScript > Language Service...

工具>选项>文本编辑器> JavaScript/TypeScript >语言服务…

Uncheck 'Enable the new JavaScript language service'.

取消“启用新的JavaScript语言服务”。

This appears to prevent the NodeJS process from starting.

这似乎阻止了NodeJS进程的启动。

#2


19  

You have to disable TypeScript support on Visual Studio:

必须禁用Visual Studio上的打字稿支持:

Tools > Extensions and Updates > TypeScript for Microsoft Visual Studio > Disable

工具>扩展和更新>打字稿为Microsoft Visual Studio >禁用

After that, just restart Visual Studio, and you are good to go.

然后,重新启动Visual Studio,您就可以开始了。

#3


17  

I raised feedback on this issue:

我就这个问题提出了反馈:

https://developercommunity.visualstudio.com/content/problem/31406/visual-studio-2017-nodejs-server-process-turn-off.html

https://developercommunity.visualstudio.com/content/problem/31406/visual工作室- 2017 nodejs -服务器-过程- - off.html转

I got response back from a MS Team - he directed me to this post:

我得到了一个微软团队的回应——他把我引向了这个岗位:

https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html?childToView=27629#comment-27629

https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html?childToView=27629评论- 27629

The node.exe process has the command line: Visual Studio 2017 - Node。JS服务器进程-关闭?

的节点。exe进程有命令行:

Effectively I was told:

有效地告诉我:

In VS 2017, several features are implemented in JavaScript. Node.js is used by Visual Studio to run that JavaScript. Among other things, Node is used to run the code that provides formatting and intellisense services when a user is editing TypeScript or JavaScript. This is a change from VS 2015.

在VS 2017中,JavaScript实现了几个特性。节点。Visual Studio使用js来运行JavaScript。在其他方面,Node用于运行当用户编辑打字稿或JavaScript时提供格式化和智能感知服务的代码。这是与2015年相比的变化。

It answers my question, but brings to light another - why do you need 1.4GB of memory to give me intellisense on JavaScript files ... or is this one of the solutions that has been built into VS so it uses Less Memory so it doesn't hit the 2GB(4GB) limit of 32-bit processes? Questions questions questions.

它回答了我的问题,但也揭示了另一个问题——为什么需要1.4GB的内存才能让我对JavaScript文件有智能感知……或者这是一个已经被构建成VS的解决方案,所以它使用的内存更少,所以它不会达到32位进程的2GB(4GB)限制?问题问题问题。

#4


9  

Ryan Ternier's answer pointed me in what I believe is the right direction. Following his link (https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html?childToView=27629#comment-27629) led me to Bowden Kelly's answer, right beneath the accepted answer.

瑞安·特尼尔的回答指出了我认为正确的方向。根据他的链接(https://developercommunity.visualstudio.com/content/27033 /nodejs-server-side-javascript- javascript- javascript-process- consumer -to.html? childtoview= 27629# comm-27629),我找到了鲍登·凯利的答案,就在公认答案下面。

Here is Bowden Kelly's answer:

下面是鲍登·凯利的回答:

The node process you are seeing is powering the JavaScript language service. You will see this process appear anytime you edit a JS file, TS file, or any file with JS/TS inside (html, cshtml, etc). This process is what powers IntelliSense, code navigation, formatting, and other editing features and it does this by analyzing the entire context of your project. If you have a lot of .js files in your project, this can get large, but more than likely the issue is that you have a lot of library files that are being analyzed. By default, we will scan every .js/.ts file in your project. But you can override this behavior and tune the language service to only focus on your code. To do this create a tsconfig.json in your project root with the following settings:

您看到的节点进程正在为JavaScript语言服务提供动力。当您编辑JS文件、TS文件或任何包含JS/TS的文件(html、cshtml等)时,您将看到这个过程。这个过程提供了智能感知、代码导航、格式化和其他编辑功能,它通过分析项目的整个上下文来实现这一点。如果您的项目中有很多.js文件,这可能会变得很大,但更可能的问题是您有很多正在分析的库文件。默认情况下,我们将扫描每个.js/。ts文件在您的项目中。但是,您可以重写此行为并将语言服务调优为只关注您的代码。为此,创建一个tsconfig。项目根目录中的json,设置如下:

{ "compilerOptions": { "allowJs": true, "noEmit": true }, "exclude": [ "wwwroot/lib" //ignore everything in the lib folder (bootstrap, jquery, etc) // add any other folders with library code here ], "typeAcquisition": { "enable": true, "include": [ "bootstrap", "jquery" //list libraries you are using here ] } }

{"compilerOptions": {"allowJs": true, "noEmit": true}, "exclude": ["wwwroot/lib" //ignore everything in the lib文件夹(bootstrap, jquery等)// // /添加任何其他带有库代码的文件夹),"typeAcquisition": {"enable": true, "include": ":

Once I added the folder with all my script libraries into the tsconfig.json file, life was good again.

一旦我将包含所有脚本库的文件夹添加到tsconfig中。json文件,生活又好了。

#5


3  

The dirtiest workaround ever: just rename the ServiceHub.Host.Node.x86.exe to something else. Hasn't bothered me since. When (if) you actually need it, just rename it back.

最脏的解决方案:只需重命名servicehu . host.node.x86。exe别的东西。没有打扰我。当(如果)您确实需要它时,只需重命名它。

Same trick works in Adobe Photoshop which also runs Node for some reason I haven't discovered in my usual workflow yet.

同样的技巧也适用于adobephotoshop,它也运行Node,因为我还没有在通常的工作流中发现它。


Turns out...

You can't just rename it and expect things to keep working. Who knew!

你不能仅仅重命名它并期望事情继续工作。谁知道!

Apparently this renaming trick only works if you suspend VS process and kill Node, then resume VS. If you try to launch VS with Node exe file renamed, it will crash when opening a project with an "unknown hard error". Also, while working on an already loaded project, the lazy reference counter above methods and properties won't work because apparently that relies on Node being there somehow.

显然,这个重命名技巧只适用于挂起VS进程并杀死节点,然后恢复VS.如果您试图启动与重命名了Node exe文件的VS,当打开一个“未知硬错误”的项目时,它将崩溃。此外,在处理已经加载的项目时,上面的惰性引用计数器和属性不会工作,因为显然这依赖于节点的存在。

So it might be okay to just suspend the Node process and let Windows paging swap its memory out from ram onto the hard drive, without renaming the exe so you could start the VS again later without going through the renaming hassle. If you're willing to live with the consequences, that is.

因此,可以暂停节点进程,让Windows分页将其内存从ram交换到硬盘驱动器上,而不必重命名exe,以便以后可以重新启动VS,而不必经历重命名的麻烦。如果你愿意承担后果,那就是。

#6


1  

Just noting that the high-memory consumption has been fixed in the May 10, 2017 - Visual Studio 2017 version 15.2 (26430.04) Release.

需要注意的是,在2017年5月10日——Visual Studio 2017版15.2(26430.04)发布时,内存消耗已被修正。

Release Notes Here: https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes

发行说明:https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes

Specific notes about the fix here: https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html

关于修复的具体说明:https://developercommunity.visualstudio.com/content/problems /27033/nodejs-server-side-javascript-process-consuming-to.html

#7


1  

Something that can help the projects mitigate the nodejs weight: is to reassign the node version used under Tools > Options > Projects and Solutions > Web Package Management to an installed 64bit version. Studio will still launch its internal Node for a tsserver.js instance, but any typescript in project will default to the supplied version -- and this helped me firsthand.

可以帮助项目减轻nodejs重量的是:将工具>选项>项目和解决方案> Web包管理下使用的节点版本重新分配到已安装的64位版本。Studio仍然会为tsserver启动它的内部节点。js实例,但项目中的任何类型文件都将默认为提供的版本——这一点帮助了我。

Also, another time I found the language service to be running down, I discovered using a simple tsconfig.json above the directories used as repositories, and specify to skipLibCheck: true, and add node_modules to exclude -- tremendously helped along the service, and one file does all folders beneath it, regardless of direct project references. P.S. -- if you do want JavaScript intellisense support still, make sure to set the allowJs: true and noEmit: true option.

另外,另一次我发现语言服务正在运行时,我使用了一个简单的tsconfig。json位于作为存储库的目录之上,并指定到skipLibCheck: true,并添加node_modules以排除——这对服务非常有帮助,一个文件可以处理它下面的所有文件夹,而不管直接的项目引用是什么。P.S.——如果您仍然需要JavaScript智能感知支持,请确保设置allowJs: true和noEmit: true选项。

Lastly, verify in the Typescript Options under the Tools > Options > Text Editor > Javascript/Typescript > Project that it is not checked to Automatically compile Typescript files which are not part of a project since that can also tie up resources for auxillary 3rd party projects using node or typescript.

最后,验证在打印稿选择工具>选项>文本编辑器> Javascript /打印稿>项目是不检查自动编译打印稿文件不属于一个项目以来,还可以为辅机第三方项目占用资源使用节点或打印稿。

These are not fool-proof, each has to find their exact bottleneck, but I have found these have worked for me and my team more often than not

这些并不是万无一失的,每个人都必须找到自己的瓶颈,但我发现,这些对我和我的团队来说往往都很管用

#1


112  

Tools > Options > Text Editor > JavaScript/TypeScript > Language Service...

工具>选项>文本编辑器> JavaScript/TypeScript >语言服务…

Uncheck 'Enable the new JavaScript language service'.

取消“启用新的JavaScript语言服务”。

This appears to prevent the NodeJS process from starting.

这似乎阻止了NodeJS进程的启动。

#2


19  

You have to disable TypeScript support on Visual Studio:

必须禁用Visual Studio上的打字稿支持:

Tools > Extensions and Updates > TypeScript for Microsoft Visual Studio > Disable

工具>扩展和更新>打字稿为Microsoft Visual Studio >禁用

After that, just restart Visual Studio, and you are good to go.

然后,重新启动Visual Studio,您就可以开始了。

#3


17  

I raised feedback on this issue:

我就这个问题提出了反馈:

https://developercommunity.visualstudio.com/content/problem/31406/visual-studio-2017-nodejs-server-process-turn-off.html

https://developercommunity.visualstudio.com/content/problem/31406/visual工作室- 2017 nodejs -服务器-过程- - off.html转

I got response back from a MS Team - he directed me to this post:

我得到了一个微软团队的回应——他把我引向了这个岗位:

https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html?childToView=27629#comment-27629

https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html?childToView=27629评论- 27629

The node.exe process has the command line: Visual Studio 2017 - Node。JS服务器进程-关闭?

的节点。exe进程有命令行:

Effectively I was told:

有效地告诉我:

In VS 2017, several features are implemented in JavaScript. Node.js is used by Visual Studio to run that JavaScript. Among other things, Node is used to run the code that provides formatting and intellisense services when a user is editing TypeScript or JavaScript. This is a change from VS 2015.

在VS 2017中,JavaScript实现了几个特性。节点。Visual Studio使用js来运行JavaScript。在其他方面,Node用于运行当用户编辑打字稿或JavaScript时提供格式化和智能感知服务的代码。这是与2015年相比的变化。

It answers my question, but brings to light another - why do you need 1.4GB of memory to give me intellisense on JavaScript files ... or is this one of the solutions that has been built into VS so it uses Less Memory so it doesn't hit the 2GB(4GB) limit of 32-bit processes? Questions questions questions.

它回答了我的问题,但也揭示了另一个问题——为什么需要1.4GB的内存才能让我对JavaScript文件有智能感知……或者这是一个已经被构建成VS的解决方案,所以它使用的内存更少,所以它不会达到32位进程的2GB(4GB)限制?问题问题问题。

#4


9  

Ryan Ternier's answer pointed me in what I believe is the right direction. Following his link (https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html?childToView=27629#comment-27629) led me to Bowden Kelly's answer, right beneath the accepted answer.

瑞安·特尼尔的回答指出了我认为正确的方向。根据他的链接(https://developercommunity.visualstudio.com/content/27033 /nodejs-server-side-javascript- javascript- javascript-process- consumer -to.html? childtoview= 27629# comm-27629),我找到了鲍登·凯利的答案,就在公认答案下面。

Here is Bowden Kelly's answer:

下面是鲍登·凯利的回答:

The node process you are seeing is powering the JavaScript language service. You will see this process appear anytime you edit a JS file, TS file, or any file with JS/TS inside (html, cshtml, etc). This process is what powers IntelliSense, code navigation, formatting, and other editing features and it does this by analyzing the entire context of your project. If you have a lot of .js files in your project, this can get large, but more than likely the issue is that you have a lot of library files that are being analyzed. By default, we will scan every .js/.ts file in your project. But you can override this behavior and tune the language service to only focus on your code. To do this create a tsconfig.json in your project root with the following settings:

您看到的节点进程正在为JavaScript语言服务提供动力。当您编辑JS文件、TS文件或任何包含JS/TS的文件(html、cshtml等)时,您将看到这个过程。这个过程提供了智能感知、代码导航、格式化和其他编辑功能,它通过分析项目的整个上下文来实现这一点。如果您的项目中有很多.js文件,这可能会变得很大,但更可能的问题是您有很多正在分析的库文件。默认情况下,我们将扫描每个.js/。ts文件在您的项目中。但是,您可以重写此行为并将语言服务调优为只关注您的代码。为此,创建一个tsconfig。项目根目录中的json,设置如下:

{ "compilerOptions": { "allowJs": true, "noEmit": true }, "exclude": [ "wwwroot/lib" //ignore everything in the lib folder (bootstrap, jquery, etc) // add any other folders with library code here ], "typeAcquisition": { "enable": true, "include": [ "bootstrap", "jquery" //list libraries you are using here ] } }

{"compilerOptions": {"allowJs": true, "noEmit": true}, "exclude": ["wwwroot/lib" //ignore everything in the lib文件夹(bootstrap, jquery等)// // /添加任何其他带有库代码的文件夹),"typeAcquisition": {"enable": true, "include": ":

Once I added the folder with all my script libraries into the tsconfig.json file, life was good again.

一旦我将包含所有脚本库的文件夹添加到tsconfig中。json文件,生活又好了。

#5


3  

The dirtiest workaround ever: just rename the ServiceHub.Host.Node.x86.exe to something else. Hasn't bothered me since. When (if) you actually need it, just rename it back.

最脏的解决方案:只需重命名servicehu . host.node.x86。exe别的东西。没有打扰我。当(如果)您确实需要它时,只需重命名它。

Same trick works in Adobe Photoshop which also runs Node for some reason I haven't discovered in my usual workflow yet.

同样的技巧也适用于adobephotoshop,它也运行Node,因为我还没有在通常的工作流中发现它。


Turns out...

You can't just rename it and expect things to keep working. Who knew!

你不能仅仅重命名它并期望事情继续工作。谁知道!

Apparently this renaming trick only works if you suspend VS process and kill Node, then resume VS. If you try to launch VS with Node exe file renamed, it will crash when opening a project with an "unknown hard error". Also, while working on an already loaded project, the lazy reference counter above methods and properties won't work because apparently that relies on Node being there somehow.

显然,这个重命名技巧只适用于挂起VS进程并杀死节点,然后恢复VS.如果您试图启动与重命名了Node exe文件的VS,当打开一个“未知硬错误”的项目时,它将崩溃。此外,在处理已经加载的项目时,上面的惰性引用计数器和属性不会工作,因为显然这依赖于节点的存在。

So it might be okay to just suspend the Node process and let Windows paging swap its memory out from ram onto the hard drive, without renaming the exe so you could start the VS again later without going through the renaming hassle. If you're willing to live with the consequences, that is.

因此,可以暂停节点进程,让Windows分页将其内存从ram交换到硬盘驱动器上,而不必重命名exe,以便以后可以重新启动VS,而不必经历重命名的麻烦。如果你愿意承担后果,那就是。

#6


1  

Just noting that the high-memory consumption has been fixed in the May 10, 2017 - Visual Studio 2017 version 15.2 (26430.04) Release.

需要注意的是,在2017年5月10日——Visual Studio 2017版15.2(26430.04)发布时,内存消耗已被修正。

Release Notes Here: https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes

发行说明:https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes

Specific notes about the fix here: https://developercommunity.visualstudio.com/content/problem/27033/nodejs-server-side-javascript-process-consuming-to.html

关于修复的具体说明:https://developercommunity.visualstudio.com/content/problems /27033/nodejs-server-side-javascript-process-consuming-to.html

#7


1  

Something that can help the projects mitigate the nodejs weight: is to reassign the node version used under Tools > Options > Projects and Solutions > Web Package Management to an installed 64bit version. Studio will still launch its internal Node for a tsserver.js instance, but any typescript in project will default to the supplied version -- and this helped me firsthand.

可以帮助项目减轻nodejs重量的是:将工具>选项>项目和解决方案> Web包管理下使用的节点版本重新分配到已安装的64位版本。Studio仍然会为tsserver启动它的内部节点。js实例,但项目中的任何类型文件都将默认为提供的版本——这一点帮助了我。

Also, another time I found the language service to be running down, I discovered using a simple tsconfig.json above the directories used as repositories, and specify to skipLibCheck: true, and add node_modules to exclude -- tremendously helped along the service, and one file does all folders beneath it, regardless of direct project references. P.S. -- if you do want JavaScript intellisense support still, make sure to set the allowJs: true and noEmit: true option.

另外,另一次我发现语言服务正在运行时,我使用了一个简单的tsconfig。json位于作为存储库的目录之上,并指定到skipLibCheck: true,并添加node_modules以排除——这对服务非常有帮助,一个文件可以处理它下面的所有文件夹,而不管直接的项目引用是什么。P.S.——如果您仍然需要JavaScript智能感知支持,请确保设置allowJs: true和noEmit: true选项。

Lastly, verify in the Typescript Options under the Tools > Options > Text Editor > Javascript/Typescript > Project that it is not checked to Automatically compile Typescript files which are not part of a project since that can also tie up resources for auxillary 3rd party projects using node or typescript.

最后,验证在打印稿选择工具>选项>文本编辑器> Javascript /打印稿>项目是不检查自动编译打印稿文件不属于一个项目以来,还可以为辅机第三方项目占用资源使用节点或打印稿。

These are not fool-proof, each has to find their exact bottleneck, but I have found these have worked for me and my team more often than not

这些并不是万无一失的,每个人都必须找到自己的瓶颈,但我发现,这些对我和我的团队来说往往都很管用