I've spent quite some time looking around for how to make NPM and bower work smooth with a website-project - and the main problem is that the node_modules-folder is so deeply nested. Causes all kinds of path-too-long-issues. This is with visual studio 2015 - website project created with older Visual Studio.
If the Visual Studio project type is "web application", and you have a .project-file for your web project, you should be able to right click files/folders in the solution explorer, and select "exclude".
However, if your Visual Studio project type is "website", there is no .project-file - you cannot exclude files and folders from Visual Studio. The trick is to set the hidden-attribute on files or folders with windows explorer - Visual Studio will then ignore them. Don't try to set hidden recursive on all subfolders - just the "outer" folder is fine.
This worked fine for me for node_modules. NPM-integration and command line NPM still works. I also removed the read-only-attribute from the folder.
If possible, consider converting your project to web application.
Read more here:
Other stack-overflow issue about website-type projects
About web application project vs. website project
About excluding items