Can I execute npm commands directly from the visual studio

23,989

Solution 1

You can use the Package Manager Console like you would a regular console. The Package Manager Console in Visual Studio acts like a PowerShell console. NPM commands such as init and install are available if npm is on your classpath.

The Package Manager Console is found under Tools -> NuGet Package Manager -> Package Manager Console.

Solution 2

Another solution if you want separate window instead of Package Manager Console: NPM task runner extension

This tool will add fancy window to run commands from package.json file (I assume you have one)

Solution 3

There is a new tool included in Visual Studio v15.8 called Library Manager for installing client side libraries. I've been trying it out after looking for a quick and easy solution to install NPM packages, and I must say it has been a pleasure to use!

You can install any NPM package by simply selecting the UnPkg provider in the GUI, or setting it in your libman.json file, like so:

"defaultProvider": "UnPkg"

Fast, lightweight, and works like a charm. Give it a try!

Share:
23,989
Anton Gorbunov
Author by

Anton Gorbunov

Hello world!

Updated on July 09, 2022

Comments

  • Anton Gorbunov
    Anton Gorbunov almost 2 years

    Can I execute npm commands (e.g. npm init, npm install) directly from Visual Studio 2017 on Asp.Net Core 2.0 project? May be from command line or context menu? Now I have context menu command for Bower, when right click on MVC project in Solution Explorer, but i'm not use bower in my project.