Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 908
Geir Sagberg Avatar asked Aug 07 '15 11:08

Geir Sagberg


People also ask

How do I prevent npm install from removing packages?

To Save : npm install --save {package_name} . This will save the package to package. json and install using npm install . You can't particularly control the dependencies(fully).

Why npm install is not working in Visual Studio code?

If you're calling npm from the VSCode terminal, you need to restart VSCode first before trying again. If you still get the error, then try restarting your computer first. The error should be gone after you restart. Now you should be able to install any npm package to your local computer with npm install command.

How do I stop npm publishing?

If you set "private": true in your package. json, then npm will refuse to publish it. This is a way to prevent accidental publication of private repositories.


1 Answers

Try this:

  • Open Tools -> Options
  • Select Projects and Solutions / External Web Tools
  • Uncheck all four paths
  • Click OK

It doesn't seem that closing the solution, etc., is necessary. NPM and Bower functionality are now disabled in VS but will work fine on the command line (assuming you've globally installed npm, bower, etc.) You may get some error messages in the Output window, but no build errors or warnings.

To restore normal operation, go back to External Web Tools and click "Reset to Defaults" in the lower right.
I haven't tried this with Publish -- you might have to restore defaults to successfully publish, try it if you encounter errors at that point.

like image 194
Van Kichline Avatar answered Oct 17 '22 03:10

Van Kichline