Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017: Is it possible to disable Node.js? [duplicate]

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.

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.

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

enter image description here

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):

enter image description here

like image 825
Ryan Ternier Avatar asked Mar 13 '17 16:03

Ryan Ternier


4 Answers

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

Uncheck 'Enable the new JavaScript language service'.

Restart Visual Studio

This appears to prevent the NodeJS process from starting.

like image 162
Andy Taw Avatar answered Oct 07 '22 00:10

Andy Taw


I raised feedback on this issue:

https://developercommunity.visualstudio.com/content/problem/31406/visual-studio-2017-nodejs-server-process-turn-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

The node.exe process has the command line: enter image description here

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.

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.

like image 29
Ryan Ternier Avatar answered Oct 06 '22 23:10

Ryan Ternier


You have to disable TypeScript support on Visual Studio:

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

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

like image 39
Gabriel Avatar answered Oct 06 '22 22:10

Gabriel


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.

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:

    {
    "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
        ]
    }
}

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

like image 33
Ralph Avatar answered Oct 07 '22 00:10

Ralph