The main objective really was the installation of front-end package manager Bower but the installation makes it clear node should be installed first. Node.js is a runtime environment and a library for running applications on a server written in JavaScript. Windows is supported.

* On nodejs.org download the Windows installer (.msi) 64-bit.
* Then install node.js. The default install will create a folder in the C:\Program Files directory but to be on the save side change to C:\ProgramData. (no whitespaces in path)
* Check that C:\ProgramData\nodejs\ is added as an environment path (echo $PATH). Now “node” is available globally.
* Restart the computer (sorry about that , otherwise it will not work)
* For testing open for example Git Bash and type “node”, a prompt will appear
* type console.log(“hi there”);
* “Hi there” is printed
* often overlooked in manuals, for the way to exit the program type: process.exit(code=0)

Also installed with node.js is nmp, the package manager. As another test (the one on nodejs.org) create server.js in C:\xampp\htdocs\zf2project

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/');

then start the server by typing node server.js

In the browser request http://zf2project.localhost:1337/. “Hello world” is printed on screen.

Advertisements