21

I am getting a bit confused here.

I have an MVC 5 project, I want to use the npm for managing my javascript packages.

I installed npm from nuget and here i am stuck, I cant find the commandline console window or anything like that.

All the info i see online is about node projects.

Can someone direct me to a relevant tutorial.

Using visual studio 2013, MVC 5.

omriman12
  • 1,644
  • 7
  • 25
  • 48
  • 1
    This might help you get started - https://medium.com/@jonjam/combining-webpack-with-asp-net-mvc-5-a5bd07c49d0b – rottweiler Feb 15 '19 at 06:22

1 Answers1

12

Well regardless of the project, if you want to use npm on Windows, this is what you need:

  1. Download and install Node (you might need a restart).
  2. Make sure that node is installed by opening a command prompt and running node -v (should print a version number).
  3. Run npm -v and see if it's installed (should be).

Now in the context of an ASP.NET MVC project. The newer versions of Visual Studio (I believe 2015) support npm - you can just open the package.json and add dependencies (it will download them behind the scenes). In case you're using an old version, you can simply open a command prompt, navigate to your project and use npm install from there.

JeeShen Lee
  • 3,476
  • 5
  • 39
  • 59
Dimitar Dimitrov
  • 14,868
  • 8
  • 51
  • 79
  • Are you sure about this? Even in 2017 it seems to be a manual process or rely upon third party extensions and configuration – IronSean Dec 13 '17 at 14:34
  • @IronSean I have to admit, I use VSCode for node projects, however I just opened VS2017 and although a bunch of things have changed, I still see plenty of integrations (Add New Item -> npm Configuration File), or right-click on a `package.json` file and "restore packages", or open the `package.json` and right click on individual packages/dependencies and update/uninstall them or go to their homepage etc. Also autocomplete packages when you type them (along with their version). So ya I think this still applies. Do you have anything specific in mind? – Dimitar Dimitrov Dec 14 '17 at 03:40
  • 1
    How is this meant to work when publishing an ASP.NET MVC 5? In my project I am referencing the node_modules folder in my BundleConfig. When I publish the files the contents of the node_modules doesn't come with it because it's not part of my solution. – Ciaran Gallagher Mar 01 '18 at 15:35
  • 2
    @CiaranGallagher Typically you would have a build setup that bundles your app in a JS output file (webpack for example) and you deploy that. – Dimitar Dimitrov Mar 02 '18 at 09:16