Installing Node.js on Windows 8

Command line showing node installation

Command line showing node installation

Over the last month I’ve slowly begun exploring Node.js and so far I’m really liking what I’m seeing.

In a nutshell, Node.js (or simply Node) allows you to write server-side JavaScript. In other words, until now JavaScript is normally written to be run within a web browser, on a web page. Node instead allows you to write JavaScript applications that run outside the browser or via the command line.

Node uses Google Chrome’s JavaScript engine, called V8. Perfect if you are used to writing JavaScript for your browser.

This means that you can now write applications, or ‘modules’ that can do stuff outside the scope of a web browser. For example, you could write a simple web server in Node or — and this is what I want to use it for — you could write modules to manipulate web code and automate certain processes related to web development.

Installing Node.js

Installation on Windows 8 could not have been any more straight forward:

  1. Visit nodejs.org
  2. Click the “install” button to download the installer.
  3. Run the installer (make sure you tell the installer to add references to your PATH system variables).
  4. Reboot your PC.
  5. Er…
  6. That’s it!

Command line

Almost everything you do with Node is via a command line. You can use either the standard Windows cmd.exe or Windows PowerShell (or, indeed, any other command line interpreter (CLI) you may have installed).

To use the standard Windows command line:

  1. Press Win + R (for Run)
  2. Type: CMD
  3. Click OK

Checking that Node is installed is as simple as opening a command line and typing:

node --version

Hit enter and you’ll get a result, something like:

v0.10.5

Node Package Manager

One of the great things about the Node installer is that it automatically installs the Node Package Manager. This makes it much easier to install additional applications to extend Node’s capabilities.

Again, you can check the version of NPM by typing the following into your CLI:

npm version

You’ll get an answer, returned as a JSON object:

{ http_parser: '1.0',
  node: '0.10.5',
  v8: '3.14.5.8',
  ares: '1.9.0-DEV',
  uv: '0.10.5',
  zlib: '1.2.3',
  modules: '11',
  openssl: '1.0.1e',
  npm: '1.2.18' }

To find out what packages are installed enter the following into your CLI:

npm ls

The result will be formatted as a directory structure, like this:

C:\Users\Gareth
├── cssmin@0.4.1
└── n@1.1.0

Obviously, to find out which globally-installed packages are available use the global flag:

npm ls -g

The first application/module that I want to investigate in depth is the CSS pre-processor Less which is used by the Bootstrap project. I will no doubt report back.

Why I love Windows 8 (but don’t have 8.1 yet)

Update to Windows 8.1 for free on the Windows 8 app store... or so they say

Update to Windows 8.1 for free on the Windows 8 app store… or so they say

On Thursday Microsoft released Windows 8.1 into the wild. Hmmm… there be dragons!

The upgrade hasn’t gone particularly smoothly for a lot of people (including me) judging by this thread (“Couldn’t update to Windows 8.1 – 0xC1900101 – 0×40017″) on the official Microsoft Community Windows forum and this article (“Windows 8.1 launch weekend plagued by some show-stopping installation issues”) on PC World.com.

The Windows RT upgrade (for Surface tablets) was removed from the app store until they could figure out what was going on. Microsoft released a “recovery image” yesterday to try to address the issue. Time will tell if it has worked, I can’t see past the search engine results noise of it having been removed.

The Windows 8.1 upgrade disappeared from my Windows 8 store for a day or two as well, but re-appeared last night. I’m still not going to try to upgrade again until I know for sure that it will work.

Windows 8

Windows 8.1 was meant to address some of the criticisms of the original Windows 8 release, particularly the removal of the Windows start button and that Windows 8 boots to the new Modern/Metro UI start screen, rather than to the desktop.

I have to say that I have been a huge fan of Windows 8 since the beta. I had the beta installed on my laptop right until the RTM edition was launched. Since then I’ve defended Windows 8 to everyone and anyone.

Windows 8 has been, by far, the fastest, most stable, most secure version of Windows I’ve used (since my standalone, not-connected-to-the-internet version of Windows for Workgroups 3.11 in the mid-90s). My desktop PC boots up and is working within about 20-30 seconds. Compare that with my Windows 7 Dell beast of a PC at work which can take about 10 minutes to start up and become fully responsive.

Start button

As for those two criticisms about the lack of start button and not booting directly to the desktop, well Start8 from Stardock (USD $4.99) addresses both those issues.

Start8 gives me back my start button and Windows 7-like start menu

Start8 gives me back my start button and Windows 7-like start menu

Firmly ticked is the configuration option in Start8 that reads “Automatically go to the Desktop when I sign in“.

I rarely use any of the Metro UI applications (occasionally TV Catch-up, the Steam tile app, and a couple of games with the boys) so it makes sense for me to jump straight to the desktop. This application saves me a click.

To be honest I installed Start8 mostly to make the PC more accessible to my wife Jane, who uses it occasionally. I didn’t want her to have to bother with the convoluted Windows 8 nonsense of Win+C > Settings > Power > Shut down, or Win+C > Settings > Control Panel to access the Control Panel. I reality though, I use those features most.

Start screen

I also have to confess that I really like the Windows 8 start screen. My grumble about the traditional Start menu in XP, Vista, 7 is that it’s a mess. It lists everything that is installed and gives everything equal status.

The Windows 8 start screen allows me to customise it for my own needs, my own priorities.

And if I want to see everything: Win + Q takes me there.

I can pin to the taskbar those applications that I use most frequently, the rest I can pin to the start screen and arrange into named groups. It’s so easy my four year old boys can use it.

The Windows 8 start screen on my PC.

The Windows 8 start screen on my desktop PC.

I used another paid-for application from Startdock to customize the background of my start screen: Decor8 (USD $4.99).

A desktop-centric Windows 8 PC

This gives me the best of both worlds: the speed and stability of Windows 8 coupled with the desktop-centric focus of Windows 7.

In each version of Windows that I’ve used I’ve tweaked it and wrestled with its user-interface to give me the experience that works for me. With Windows 3.11 I used Calmira, in Windows 98 it was power toys and TweakUI, in XP I created my own toolbars. Why should this operating system be any different? Surely that’s one of the beauties of Windows.

I really don’t understand these grumbles of “I hate Windows 8 and the Modern/Metro UI!” To be honest, I don’t notice the juxtaposition of desktop vs Modern/Metro UI much. I ignore most of it. I don’t have a touch screen, I have all the Windows desktop applications that I need and only occasionally dabble with the odd Modern/Metro app. And Start8 and Decor8 allow me to quickly tweak the rest

Windows 8.1

And so back to Windows 8.1. I would rather like to upgrade sometime soon.

I tried it on Friday.

It all seemed to be going well until the second boot when it halted the screen that Windows 8 shows when it’s booting up. The little spinner just kept on spinning… for about 30 minutes. So I rebooted the PC… and it did the same until it quickly flashed up a blue screen of death (BSOD) and about 10 minutes later returned me to Windows 8 and a message similar to this one but with error code 0xC1900101 – 0×40017.

Couldn't update to Windows 8.1

Couldn’t update to Windows 8.1

I’ve been closely following, and contributing to the thread on the Microsoft Community. People have had limited success it would appear with certain workarounds working for some but not others: uninstall graphics card drivers, uninstall SteelSeries Engine software, unplug everything, etc.

I have a SteelSeries mouse. I could uninstall it and try the upgrade again, but do you know what? It’s 2013. Why should I have to? Modern operating systems should just work and upgrade without any kind of hardcore hardware geekery.

I’m going to wait until either Microsoft have figured out a way for the operating system to work around or quietly remove incompatible device drivers or until Steel Series have made their drivers compatible with Windows 8.1. Which in my opinion they should have done by now.

Windows 8.1 was code-named “Blue”. It looks like they omitted “…Screen of Death” at the end of it.

Disappointing, and at a time when Microsoft is fighting to stay relevant this seems to me to be a terrible blow to its reputation. As I said, I’ve been almost evangelical about the stability and reliability of Windows 8. I’m not at all confident about upgrading to 8.1 now. That’s not a good thing.

The trial continues…

Which button should I press?

Here’s an odd dialog box I spotted the other day. I had just run MySQL Workbench 5.x for the first time in a few months (I tend to use Navicat Premium Essentials these days) and it ran a quick check to see if the software was up-to-date. It wasn’t and presented me with this dialog box:

MySQL Workbench dialog box shows 3 options: OK and Get It Now and Cancel

You can download the latest version. Which button would you press?

So, which button should I press to get the update?

The text reads, “The new MySQL Workbench 6.0.6 has been released…” (was there an old MySQL Workbench 6.0.6?) “You can download the latest version from http://www.mysql.com/downloads/workbench.”

And then I’m presented with two options: OK and Get it Now.

My train of thought was: it says I can download it from this URL, so okay I want to download it.

I clicked OK.

The dialog box closed and nothing else happened.

What?! What just happened there. I thought I had just said that I wanted to get the new version. I clicked OK but it did what I would expect a cancel button would do. But that’s cancel! There is already a cancel button. And there is also a red [x] button in the top right-hand of the dialog box which also cancels the dialog box.

That’s THREE different ways to cancel the dialog box. But they are offering me an upgrade, to make the software better, so why not make that the most obvious, easiest to select option?

Surely this would be a better dialog box:

This dialog box now has one clear call to action.

This dialog box now has one clear call to action.

Now it’s simply telling me that MySQL Workbench 6.0.6 has been released, where I can download the latest version if I want to do it independently of this dialog, and now there is only one, clear call to action: Get it Now.

Matching Google Chrome’s developer tools theme to your text editor theme

Sublime Text 2

Sublime Text 2

My main coding text editor is the excellent Sublime Text 2, my favourite theme is called Tomorrow-Night by Chris Kempson, and my go-to browser is Google Chrome.

Being involved in web design I use the Chrome web developer tools all the time for debugging JavaScript, identifying HTML classes and tweaking CSS. It looks like this:

Google Chrome developer tools

Google Chrome developer tools

But as you can see from the screenshot above, the default view is rather dull: white background, uninspiring syntax highlighting. It’s a shame that you can’t match the Chrome developer tools code panel with my text editor of choice.

User StyleSheets

Well, it turns out you can! Chrome provides a “User StyleSheets” directory into what you can drop a Custom.css file.

Windows
C:\Users\%username%\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\
Mac
~/Library/Application Support/Google/Chrome/Default/User StyleSheets/
Ubuntu
~/.config/chromium/Default/User StyleSheets/

A number of people have also done the hard work for us and made available ready-to-use CSS files for various themes. These are my two favourite dark themes:

  • Tomorrow
  • Monokai (UPDATED: This version works better when editing code in the Elements tab.)

Having saved the code to your Custom.css file and saved it, Chrome updates immediately:

Google Chrome developer tools with Tomorrow theme

Google Chrome developer tools with Tomorrow theme

Installing Steam games on a second hard drive

Steam logo

About a month ago I took delivery of a new, much faster PC from PC Specialist. Now I’m getting around to reinstalling games, and I’ve just discovered a neat trick to install Steam-powered games on a second hard drive.

My last PC had served me well for about six years but it was creaking a little around the seams and was being pushed very hard particularly when gaming. It was time to upgrade.

And after upgrades comes the often arduous task of reinstalling applications.

dual-boot or not dual-boot?

On my last two PCs I’ve always set up a dual-boot environment. One partition (C:) was for day-to-day applications (email, web browsing, web development, image editing, etc.), the next (D:) was for games. My reasoning was:

  1. Clean installation of Windows with minimal, and only essential, drivers.
  2. Less distracting. If I wanted to play games then I would need to reboot the PC into the games partition.

However, in practice what it meant was:

  1. Twice as much work, keeping two versions of Windows up-to-date, with both Windows updates and driver upgrades.
  2. It was such a hassle to shut down everything and reboot that I rarely ever played any games. The only people to play were Reuben and Joshua when they played the LEGO Star Wars games.

So I decided on this PC to single-boot (Windows 8 Pro, 64-bit) and install everything side-by-side across two hard drives: my main applications are on C: (120 GB SSD); most of my data plus games are on D: (1 TB Western Digital SATA drive).

So far, so good. I’ve played games more in the last couple of weeks than in the last couple of years, but contrary to my fears it’s not distracted me from my main work on my PC.

However, this evening I realised after installing the Steam client for the first time that it was about to install all 7.8 GB of Call of Duty: Black Ops onto C.

No, no, no, no, no!

Moving Steam to a second hard drive

It turned out to be a pretty easy task to move Steam from C to D. I found the instructions on the Steam support website.

By default Steam installs to C:\Program Files\Steam (or C:\Program Files (x86)\Steam on 64-bit editions of Windows) and the games install to C:\Program Files\Steam\steamapps.

“During the installation of Steam, you have the option to install Steam to a location other than the default. Since Steam relies on the game files residing in the SteamApps folder, your game files will go to whatever folder you have Steam installed in. The game files must be in the SteamApps folder in order to function.”

So, here’s what to do, assuming that you’ve already installed Steam to C:.

  1. Log out and exit Steam.
  2. Navigate to the folder where Steam is installed (by default: C:\Program Files\Steam\; or C:\Program Files (x86)\Steam\ on 64-bit).
  3. Delete all of the files and folders except the SteamApps folder and Steam.exe.
  4. Cut and paste your Steam folder to the new location, for example: D:\Program Files\Steam\.
  5. Launch Steam.
  6. Steam will briefly update and then you will be ready to play.

Conclusion

I’ve just done this and it worked.