Last Updated: December 26, 2021
·
109.7K
· nirth

Running nodejs and express on Windows

  • Download and run nodejs installer from nodejs.org.
  • Run cmd.exe:
    • Press Windows+R on a keyboard.
    • Type "cmd" without quotes and press enter.
    • Check if node is installed successfuly by typing "node -v" without quotes, it should respond with "v#.#.#" where # stands for number
    • Restart computer if "node -v" does not respond correctly.
  • Try to automatically install all dependencies via "npm install" command
  • If and only if previous step failed install dependencies manually by executing following commands:
    • Run "npm install"
    • "npm install express -g"
    • "npm install url -g"
    • "npm install fresh -g"
    • "npm install cookie -g"
    • "npm install methods -g"
    • "npm install crc -g"
    • "npm install send -g"
    • "npm install connect -g"
    • "npm install commander -g"
  • Attempt to run server by executing "node app" withing server root folder.
  • Allow access to that application through the Windows Firewall:
    • Advanced settings of a Windows Firewall: "Control Panel > System Ecurity > Windows Firewall > Advanced Settings".
    • Create new rule.
    • Select "Port" and press "Next".
    • Allow TCP and port your are attempting to expose (default 3000, you might want to expose 80), and press "Next".
    • Select "Allow the connection" and press "Next".
    • Check all: Domain, Private, Public and press "Next".
    • Type "Acne Challenge Server" as name, and press "Done".
  • Restart OS
  • Open cmd : Windows+R, type "cmd" and hit "Enter".
  • Run "node app" from within highscores directory.
  • Server is ready.

4 Responses
Add your response

You are aware of ms webmatrix right. It includes templates for node.js express development.

over 1 year ago ·

Run Vagrant, configure your development server as identical as possible to your production server, never install server software on your "client" again.

Since discovering Vagrant my workflow has become immeasurably more enjoyable. In a matter of minutes I can test my applications across a vast array of configurations - your imagination is the only limiting factor. I can reformat my machine right now and be back to full-scale development within 2 hours since my machine doesn't require any server software or configuration.

No exaggeration, I reformatted my machine last weekend and these were the exact steps I took to get back to work:

  • Install Google Chrome
  • Install Sublime Text 2
  • Install Git
  • Install Oracle VirtualBox
  • Install Vagrant
  • git clone dotfiles
  • git clone current-project
  • vagrant up

Done. Back at full-scale development efforts on the exact same development configuration I was using 2 hours ago. Which, an added benefit for remote teams, is as easily distributed as passing along a few files. I can have anyone up and running in my exact environment in less than 3 minutes once they have Vagrant installed.

over 1 year ago ·

Hello,
thanks for the tutorial. I am following your article's steps. I have install everything. Right now, I am stuck on "Attempt to run server by executing "node app" withing server root folder." I am not getting you, what you mean by that. I also try to setup rules on advance security panel. But, couldn't do it. Can you please help me.

over 1 year ago ·

Nice job, it's good for me.
But, one more thing should be revised, "Control Panel > System Ecurity" is wrong.
It should be "Control Panel > System Security".

over 1 year ago ·