Categories
node.js npm visual-studio visual-studio-2015

How can I disable NPM package restore in Visual Studio 2015?

When I open a project with a package.json in Visual Studio 2015, an npm install is automatically started, and VS is unresponsive until the install is completed.

I would much rather prefer running npm install myself from the command line; how can I stop Visual Studio from doing it?

If you upgrade to Visual Studio 2017 (the free ‘Community Edition’ is fine) then the VS team have added an option to stop npm running when a project is opened. It’s under Tools/Options/Projects and Solutions/Web Package Management/Package Restore. You can disable NPM (and Bower) restores on Project Open and on package.json Save separately.

Note also that for the node.js project types (NTVS) only the automatic package restore behavior is disabled completely in VS2017 at present.

Edit: the above answer also applies to Visual Studio 2019. The menu options are in the same place, although Bower support has been deprecated.