Looking for new ways to level up in the web development world I am always looking to do things more efficiently. Along my quest for efficiency I recently ran into Gulp, a building tool that uses node js under the hood and is powered by npm, Node Package Manager. npm is a great tool to manage node packages and dependencies, kind of like rpm and yum are to Red Hat, or pacman is to Arch. A lot of popular tools out there right now, like LESS, Grunt, Gulp, and CoffeeScript have node packages available for download. You could probably develop all aspects of an entire project with tools that were download from a node repository.
For Windows
- Install Node JS. nodejs
- Hit the install button. The website will recognize your user agent and start downloading the correct distribution. At the time of this post, the latest version is 0.10.28.
- Start the installer and run through the installation as usual.<
- Navigate out to C:\Program Files, you should see the nodejs folder here now.
- Right click on the Nodejs folder and select properties.
- Select the security tab.
- Select edit on the security pane.
- In the box that pops up, select the users group and give that group full control. This will allow you to work with npm to install packages into the nodejs directory without issues.
- Hit OK and OK again to close the properties.
- Steps 4 and 5 are optional if npm does not work after install nodejs. If npm is available, skip to step 5 ## and test npm out.
- Install Git.
- Navigate out here to get the latest download of Git. At the time of this post the latest version is: 1.9.3.
- Run through the installer that Git gives you and make sure for Windows to select the option that describes: “Run Git from the Windows Command Prompt.
- Clone npm with Git!
- Start up the command prompt and run these commands:
# navigate to the base of your C: directory > cd / # make git aware of the signing certificate > git config --system http.sslcaininfo /bin/curl-ca-bundle.crt # clone the npm repo from github > git clone – recursive git://github.com/isaacs/npm.git # change directories to npm > cd npm #install command line usage globally for npm > node cli.js install npm –gf
5. OK, Node and npm are installed, happy downloading! Try it out by creating a blank folder and installing an npm package.
# create a blank folder and jump into the new folder > mkdir test > cd test # using npm install less in this folder > npm install less # you should now see the node_modules folder in this directory, success!
For Mac:
- Install Node JS. http://nodejs.org/
- Hit the install button. The website will recognize your user agent and start downloading the correct distribution. At the time of this post, the latest version is 0.10.28.
- That is it, npm comes packaged in with NodeJS on Mac and should run right away.
In case npm is not working, use git to clone the npm repo, pull it down and install it globally.
If there are any questions please let me know.