You say you can't uninstall node tools, but ultimately, I had to uninstall Node Tools before I could get a usable Visual Studio. With default settings and Node Tools installed, Visual Studio auto install package.json, then auto-analyzes those files in an attempt to create code-hinting intellisense, Node tools would create a remarkably large .ntvs_analysis.dat cache file. After all this forced setup and analysis, if I didn't CTRL-ALT-DEL my way out of a 5-30 min freeze, it would work for a few minutes before crashing again. I’d see a spike in memory and cpu usage until my laptop would freeze, and the .ntvs_analysis file only got larger. It took me a while to realize I could still use and make node projects without Node Tools.
- Place the package.json file in a parent directory of the solution files so visual studio doesn't have a chance to analyze (and die) trying to build intellisense for the large node_modules folder. This file could be as at your root c:\ drive, but place it where it makes sense for your project's scope. (hiding the node_modules folder also works, but new users to the same project will need to hide their folder as well, and they will need to do it before VS tries to auto-install package.json).
- Using the command window, run
npm install
at the location of your package.json folder.
- Task Runner Explorer will search parent directories package.json. It will load tasks defined in the "scripts" tag of your package.json, as well as tasks defined in your gruntfile.js or gulp.js files.
- Use an ASP.Net web application for your project type, but build your node project as usual.
- If all else fails use a different IDE (please sense my shared frustration toward visual studio with you in this point). I recommend Sublime.
This workaround still makes it challenging to work in TFS in the way our team files are organized.
If, as you say, you must have node tools, turn off other plugins, turn off intellisense, at that point, after following my own advice, I realized I was better off with notepad (arg!).
You could ignore certain directories for analysis--
A quote from https://github.com/Microsoft/nodejstools/wiki/Projects#ignoring-directories-for-analysis :
It may be useful to ignore certain directories, such as client side JavaScript, from analysis. There are many reasons to do this but the biggest two are:
- the particular directory is large and takes a great deal of time to analyse.
- The directory contains client side code that doesn't need to be analysed.
There is a property in the .njsproj file that can be used to ignore directories. The following code can be added to the project file under a PropertyGroup:
<PropertyGroup>
<!-- Specifies the directories which are ignored. Any paths
which contain these directory names will be ignored.
The directory name must completely match and no wild cards
are allowed
-->
<AnalysisIgnoredDirectories>bower_components;dir_not_included</AnalysisIgnoredDirectories>
</PropertyGroup>
Note that all filepaths containing the specified string will be ignored. So if you specify dir_not_included, every filepath containing dir_not_included will be ignored (including subdirectories).
This property takes precedence over other settings. This includes whether you included the file in your project or not. If you specify a directory here as ignore it will not be analysed.
You are not the only developer to scratch their head over this, for all of Microsoft's advertising node.js support, the support is very thin, if some very smart people in my team and I find themselves fighting Visual Studio when using node projects.
I hope someone has a better answer than mine, because I'm also interested in a better solution.