Thursday, May 17, 2012

Install Node on Windows with NPM tutorial

This post is written for nodejs version 0.6.18. 


Intro:

It took me a while to figure out a few things after installing node so this is just a few notes to help you get started.

Steps:

- Download and install node from http://nodejs.org

- Open a command-line in window using Run As Administrator

- make a test folder and go to that folder: c:\node_test\

- Create a hello world script: echo console.log("Hello World") > hw.js

- Run the test: node hw.js
Expected output: Hello World
Check: If you see an error here, something is wrong with your nodejs installation. Check your path maybe...

- Enter npm install less  to install the less module. It does not really matter what module you install, this just proves that the package manager called NPM works.
Expected outcome: NPM downloading modules
Check: If you see an error here, something is wrong with your nodejs installation or with NPM.

- Your working directory should have a folder node_modules and a sub folder less.
Check: If you don't have those folders then something is wrong with where NPM installs modules.

- To test the module: node node_modules\less\bin\lessc -help
Expected output: a help message from less
Check: If you get an error, something is wrong with where or how NPM installs modules.

If you got to this point without any errors, you are good to go.

I hope this helps

- Sly

7 comments:

  1. You have a spelling mistake in your tutorial, the command to install less should be npm and not nmp.

    ReplyDelete
  2. Very helpful. Thank you!

    ReplyDelete
  3. Hey there, Awesome article, I'm going throw steps of understanding how all this works.
    Noticed a typo ;) "Create a hello word script: echo console.log("Hello World") > hw.js"
    hello word should be hello world?
    (feel free to delete this comment if you like ! (: )

    ReplyDelete
  4. Thanks. It is really helpful. Worked Like a charm :D.

    Thanks Again.

    ReplyDelete