Dominic P Dominic P - 1 year ago 101
Node.js Question

Installing Node Grunt Locally

I'm in the process of reworking my build system, and I've read that node.js with grunt is a good way to go. I've never used either, and I'm having a bit of trouble.

The problem is that I want to set up a portable build environment that I can include in the version control for my project (maybe this isn't possible). Getting node.js and npm working has been no trouble. But, every instruction I see for installing grunt says to use the

flag with npm which installs it globally. Since I want a totally portable environment, I have attempted to leave this off, but I can't get grunt to work.

Am I missing something, or is what I'm attempting to do not feasible?

Answer Source

Have a look at

Grunt has recently been split into a project-local dependency (grunt) and a command-line launcher (grunt-cli). It's the latter that should be installed globally.

As an extra hint on ensuring that you can take your builds everywhere: make sure you save all dependencies in package.json, by using the --save and --save-dev parameters when using npm install. More info:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download