0

I wanted to start practicing ES6, and plan to do that using Node.js (--harmony) in the first instance. I have the stable 0.10 branch on my Ubuntu computer already and want to run the unstable version just for testing new coding styles.

Is there a way of running a node 0.11 instance locally to a project (i.e. from node-modules?), or some other best practice?

Or, as this is a development machine anyway, perhaps I could just replace stable Node with unstable anyway as it is now 'stable enough'?

kangax
  • 38,898
  • 13
  • 99
  • 135
Simon H
  • 20,332
  • 14
  • 71
  • 128

1 Answers1

1
  1. Install some node version manager: n or nvm. For example, let's install n:

    $ sudo npm install -g n
    
  2. Install node version you want to use for your project. For expamle, 0.11.14:

    $ sudo n 0.11.14
    
  3. Add scripts start command to your package.json:

    {
        "name": "some-project",
        "version": "0.1.0",
        "scripts": {
            "start": "n use 0.11.14 ."
        }
    }
    
  4. Run your project from project folder:

    npm start
    
  5. Enjoy:)

alexpods
  • 47,475
  • 10
  • 100
  • 94