Skip to content

Instantly share code, notes, and snippets.

@ComFreek
Last active August 29, 2015 14:15
Show Gist options
  • Save ComFreek/c341bacfaae3aca887df to your computer and use it in GitHub Desktop.
Save ComFreek/c341bacfaae3aca887df to your computer and use it in GitHub Desktop.
How to use an older Node.js version on a per-project basis
  1. Download an old NodeJS MSI package. A list of download URIs can be found here: https://chocolatey.org/packages/nodejs.install/ For example, click on 10.36 in the table, click on • tools\chocolateyInstall.ps1 Show and copy the URI from the shown file.

The URI for 10.36 x64 is http://nodejs.org/dist/v0.10.36/x64/node-v0.10.36-x64.msi.

  1. Download the MSI file and open it with 7-Zip (or a similar program). Extract node.exe to {your-project-folder}\old-node

  2. Download either start-old-node.ps1, start-old-node.bat or start-old-node-ps.bat from this Gist and place it into your project folder. The differences are as follows:

  • start-old-node-ps.bat (recommended): Batch script which starts a PowerShell shell. It can be started by a simple double-click in Explorer.
  • start-old-node.ps1: PowerShell script which starts a PowerShell shell. It must be started by right-clicking and selceting Run with PowerShell in Explorer.
  • start-old-node.bat: Batch script which starts a CMD shell. It can be started by a simple double-click in Explorer.
  1. Whenever you want to use the old Node.js version, simply open a shell by using one of the scripts outlined above and do what you would normally do.

  2. If you would like to test the behavior, you can execute node --version.

How to use an older Node.js version on a per-project basis
SET mypath=%~dp0old-node
SET PATH=%mypath%;%PATH%
cls
powershell
SET mypath=%~dp0old-node
SET PATH=%mypath%;%PATH%
cls
cmd
$env:Path = (Join-Path $pwd "old-node") + ";" + $env:Path
powershell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment