Wednesday, August 6, 2014

Addressing the problem with npm install jest-cli on Windows 8

This post is specifically about trying to get Facebook's Jest testing library working on a machine running Windows 8 (or 8.1).  I also happen to have Visual Studio 2013 installed (and just this version).


Install Python

I will assume that node and npm are already up and running on your machine.  You need to have Python 2.7.x installed.  Version 3 is out already but we need 2.7.  During the install you have to manually enable the option that puts Python in your Path environment variable.


Install jest-cli

Open a command prompt in your project root and type:
npm install jest-cli --save-dev --msvs-version=2013

The reason you need the --msvs-version option is that the contextify node package will need to be built using VS build tools and it will look for 2010 by default.  Be sure to specify the correct version on your machine.  Credit goes to Kevin Griffin for his article on this.


If all goes well you should see no errors.  Here is what my package.json file looks like afterwards:

{
  "name": "reapcast",
  "version": "1.0.0",
  "description": "smart podcasting",
  "devDependencies": {
    "jest-cli": "^0.1.18"
  },
  "scripts": {
    "test": "jest"
  }
}


1 comment:

  1. Thanks for your post. Noticed a small typo that held me up for a moment, "--msvs-version" should be "--msvs_version".

    ReplyDelete