I'm using Windows 7, Visual Studio 2013. I'm trying to set up Gulp in my Client's project.
I've added those Nugets to the project: Node.js version 0.12.0 Npm.js version 1.3.15.10.
For some reason I don't know, when running npm init
inside the nuget package manager when the default project is the client, it is not creating a package.json file, no question are asked regarding the file, and the command never exits.
Is this related somehow to the fact that I only worked through the Visual Studio project? Later on I downloaded Node.js through the installer because I saw no version of node.js existed on my pc.
Do I need to install npm also outside of Visual studio? I don't have access to the network there, should I get an .msi file?
Regarding the Gulp nuget package, I've read in other sites that Gulp should be installed through npm using this command: npm install gulp -g -save dev
. I can't run that command because I have no network connection, therefore how can I do that only with the gulp nuget package?
Please help me understand what steps are needed to get node.js, npm, and finally Gulp running
I don't know what the deal is with npm init
, but my first suggestion is to try a newer version of npm -- the current version is 3.9.6; I suspect you'll have a better time if you use a more up-to-date version. Generally, npm and node are intended to be installed globally, and not for a single package; I don't know a lot about nuget, but that may also be causing trouble (I think if you install npm locally, you should be able to use it just fine, though, like ./node_modules/.bin/npm init --yes
, which is why I list it second). You can get the msi to install the lts release of both here, though I gather you don't have network access. If that doesn't work, you can create a package.json by hand fairly easily, and it'll be just as good as the auto-generated one -- here are some reasonable examples. You might also consider filing an issue with npm.
As to what to do to install gulp if you can't run npm i -g
, it is easier than you might expect to work around. There is no difference between the gulp that is installed locally and the gulp that is installed locally, they just use two different scripts when you access them. When you require("gulp")
, you get the script listed in main, and when you run gulp
at the command line, you get the script listed in bin, and both are included in both a local and global install (you can look at gulp's package.json for more details). So, what that means for a global install is that all you need to do is get gulp's bin file (node_modules/gulp/bin/gulp.js
, or node_modules/.bin/gulp
, which points to node_modules/gulp/bin/gulp.js
) on your PATH somehow (you can't just copy the script to a folder on your path, though, it needs all the other things from its folder in node_modules to work too), or you can call the bin script from your local install directly (I'm a linux user, so I'd run the compile
task like this: ./node_modules/.bin/gulp compile
-- I don't know how to Windows, so I hope that gets you close enough).