Visual Studio 2017 - Node.JS Server Process - Turn off?

前端 未结 9 1565
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 10:33

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

相关标签:
9条回答
  • 2020-12-12 10:42

    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.

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


    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.

    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.

    0 讨论(0)
  • 2020-12-12 10:42

    To disable Language Services in VS Code, go to extensions, then filter on builtin extensions and disable the TypeScript/Javascript language service.

    I finally discovered this after VS code's node service crashed my server about a million times. Annoying that this was so hard to find documentation about.

    0 讨论(0)
  • 2020-12-12 10:51

    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.

    0 讨论(0)
  • 2020-12-12 10:55

    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.

    0 讨论(0)
  • 2020-12-12 10:55

    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.

    0 讨论(0)
  • 2020-12-12 10:59

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

    Release Notes Here: 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

    0 讨论(0)
提交回复
热议问题