Skip to content

Instantly share code, notes, and snippets.

@CTimmerman
Last active September 5, 2021 08:07
Show Gist options
  • Save CTimmerman/bb1199f17553538478bc to your computer and use it in GitHub Desktop.
Save CTimmerman/bb1199f17553538478bc to your computer and use it in GitHub Desktop.
Node.js from scratch in Windows
  1. Install Node.js from http://nodejs.org
  2. Open a Command Prompt and run "c:\Program Files\nodejs\npm" install -g learnyounode
  3. Run C:\Users\USERNAME\AppData\Roaming\npm\learnyounode.cmd where USERNAME is your Windows login name.
  4. Instead of writing code in Notepad, I recommend Notepad++ with the NppExec plugin, this F6 script:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\Program Files\nodejs\node.exe "$(FULL_CURRENT_PATH)"

And these Shift+F6 HighLight filters with Red set to FF:

%ABSFILE%:%LINE%
* (%ABSFILE%:%LINE%:%CHAR%)

Doubleclicking highlighted output in the Notepad++ console will focus on the bug.

  1. Check examples in a relevant client like your web browser for the main example:
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
@CTimmerman
Copy link
Author

A reboot might help with not having to specify the location of the executables.

@golam71
Copy link

golam71 commented Sep 5, 2021

thank u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment