#Update 2
Attempting to further emphasize my question, I'll try and cite a more specific example. I want to use the library Q.js
in my ASP.NET MVC
application. Now, there is a version 1 that I can seem to run out of the box, but I want to try out version 2 - you can find it linked Q.js v2 (beta)
So I am using Visual Studio, and I'll download the q.js
file and load it up, but immediately we already have trouble now - if you look at the file's source code right away I see this.
require("collections/shim");
var WeakMap = require("collections/weak-map");
var Iterator = require("collections/iterator");
var asap = require("asap");
Now I certainly don't have folders with those names in my application - and even though I have node.js
installed, putting this file in a <script>
tag does not work, as it says it cannot find the specific libraries. If I go to a console explicitly and type in npm install -g q@~2
, it will create a folder called node_modules/q
in my AppData/Roaming/npm
folder, and this one does have folders for those other libraries.
So what is the right way to do this? It's clear that just having node installed doesn't make node commands work when I try to run the page in ASP.NET MVC - but I also don't understand how to get to the final version of the library that I can include on my application like a normal javascript file and use across the program.